generate a random grid for game of life using a 
    set of patterns (just to make it interesting)
342937
def set_random_starting_grid(lfe):
    
    cls_patterns = mod_grid.GameOfLifePatterns(25)
    print(cls_patterns)
    exit(0)
    
    patterns = cls_patterns.get_patterns()
    for pattern in patterns:
        lfe.set_tile(pattern[0], pattern[1], 1)
936302
def make_data(n):
    
    p,r,d,w = {},{},{},{}

    J = range(1,n+1)

    for j in J:
        p[j] = random.randint(1,4)
        w[j] = random.randint(1,3)

    T = sum(p)
    for j in J:
        r[j] = random.randint(0,5)
        d[j] = r[j] + random.randint(0,5)

    return J,p,r,d,w
597388
public void generateGrid() {
        minx = minx - extendGrid;
        maxx = maxx + extendGrid;
        miny = miny - extendGrid;
        maxy = maxy + extendGrid;
        minz = minz - extendGrid;
        maxz = maxz + extendGrid;

        dim[0] = (int) Math.round(Math.abs(maxx - minx) / latticeConstant);
        dim[1] = (int) Math.round(Math.abs(maxy - miny) / latticeConstant);
        dim[2] = (int) Math.round(Math.abs(maxz - minz) / latticeConstant);

        grid = new double[dim[0] + 1][dim[1] + 1][dim[2] + 1];
    }
425964
def make_grid(xx, yy):
    
    n = len(xx)
    xx, yy = np.meshgrid(xx, yy)
    grid = np.array([xx.ravel(), yy.ravel()]).T
    x = grid[:, 0].reshape(n, n)
    y = grid[:, 1].reshape(n, n)
    return x, y
529901
def generate_or_fail(self):
        

        t1 = self.generate_random_table()
        t2 = self.generate_random_table()
        f1 = self.generate_func(t1)
        f2 = self.generate_func(t2)
        edges = [(f1(word), f2(word)) for word in self.words]

        # Try to generate that graph, mack!
        # Note that failure to generate the graph here should be caught
        # by the caller.
        graph = forest.ForestGraph(edges=edges)

        # Associate each edge with its corresponding word.
        associations = {}
        for num in range(len(self.words)):
            edge = edges[num]
            word = self.words[num]
            associations[graph.canonical_order(edge)] = (num, word)

        # Assign all of these to the object.
        for name in ('t1', 't2', 'f1', 'f2', 'graph', 'associations'):
            self.__dict__[name] = locals()[name]
1371213
def create_random_ind_grow(self, depth=0):
        ""
        lst = []
        self._depth = depth
        self._create_random_ind_grow(depth=depth, output=lst)
        return lst
1297753
public void createCubicGrid() {
        //		logger.debug("	CREATE CUBIC GRID");
        gridGenerator.setDimension(findGridBoundaries(), true);
        gridGenerator.generateGrid();
        this.grid = gridGenerator.getGrid();
    }
549000
def generate(number=4, choice=SystemRandom().choice, words=words, joiner=" "):
    
    return joiner.join(choice(words) for each in range(number))
1359358
def drawHUD(self):
        
        self.win.move(self.height - 2, self.x_pad)
        self.win.clrtoeol()
        self.win.box()
        self.addstr(2, self.x_pad + 1, "Population: %i" % len(self.grid))
        self.addstr(3, self.x_pad + 1, "Generation: %s" % self.current_gen)
        self.addstr(3, self.x_grid - 21, "s: start    p: pause")
        self.addstr(2, self.x_grid - 21, "r: restart  q: quit")
227375
def grid(opts = {})
      range = Args::CardRange.new(opts[:range], deck_size: size)
      draw  = Args::Draw.new(custom_colors).load!(opts, expand_by: size, layout: layout, dpi: dpi)
      box   = Args::Box.new(self).load!(opts, expand_by: size, layout: layout, dpi: dpi)
      range.each { |i| @cards[i].grid(box[i], draw[i]) }
    end
168115
def random_draw(self, size=None):
        
        return scipy.asarray([scipy.stats.gamma.rvs(a, loc=0, scale=1.0 / b, size=size) for a, b in zip(self.a, self.b)])
877883
def generator(self, random, args):
        """"""
        locations = [i for i in range(len(self.weights))]
        random.shuffle(locations)
        return locations
1329471
def coord_grid(self):
        """"""

        import math,ephem
        ra2=math.pi*2
        ra1=0
        dec1=-1*math.pi/2.0
        dec2=math.pi/2.0

        
        ## grid space choices
        ## ra space in hours
        ra_grids=["06:00:00",
                  "03:00:00",
                  "01:00:00",
                  "00:30:00",
                  "00:15:00",
                  "00:05:00",
                  "00:01:00",
                  "00:00:30",
                  "00:00:15",
                  "00:00:05"]
        dec_grids=["45:00:00",
                   "30:00:00",
                   "15:00:00",
                   "05:00:00",
                   "01:00:00",
                   "00:15:00",
                   "00:05:00",
                   "00:01:00",
                   "00:00:30"]
        dra=(self.x2-self.x1)/3.0
        ddec=(self.y2-self.y1)/3.0
        for ra_grid in ra_grids:
            if self.hours(ra_grid)<math.fabs(dra):
                break
        ra_grid=self.hours(ra_grid)

        for dec_grid in dec_grids:
            if self.degrees(dec_grid)<math.fabs(ddec):
                break
        dec_grid=self.degrees(dec_grid)
        
        ra=ra1
        n=0
        import Tkinter,ephem
        while (ra<=ra2):
            (cx1,cy1)=self.p2c((ra,dec1))
            ly=cy1-30
            (cx2,cy2)=self.p2c((ra,dec2))
            self.create_line(cx1,cy1,cx2,cy2)
            lx=cx1
            n=n+1
            if n==2:
                dec=dec1
                k=2
                while ( dec <= dec2 ):
                    (lx,ly)=self.p2c((ra,dec))
                    (cx1,cy1)=self.p2c((ra1,dec))
                    (cx2,cy2)=self.p2c((ra2,dec))
                    self.create_line(cx1,cy1,cx2,cy2)
                    k=k+1
                    if k==3:
                        self.create_text(lx-45,ly-12,text=str(ephem.hours(ra)),fill='green')
                        self.create_text(lx+40,ly-12,text=str(ephem.degrees(dec)),fill='brown')
                        self.create_point(ra,dec,color='black',size=3)
                        k=0
                    dec=dec+dec_grid
                n=0
            ra=ra+ra_grid
724061
def tictactoe(w, i, player, opponent, grid=None):
    ""
    grid = grid or empty_grid
    while True:
        w.render_to_terminal(w.array_from_text(view(grid)))
        if is_won(grid):
            print(whose_move(grid), "wins.")
            break
        if not successors(grid):
            print("A draw.")
            break
        grid = player(w, i, grid)
        player, opponent = opponent, player
1314652
function generate() {
    var rnum = Math.floor(Math.random() * 10);

    var mood = rnum <= 8 ? "good" : "bad";

    var sentences = [_sentence_mgr2.default.feeling(mood), _word_library2.default.warning(), nu.chooseFrom([_sentence_mgr2.default.relationship(mood), _sentence_mgr2.default.encounter(mood)])];

    // randomize (shuffle) the array
    sentences = nu.shuffle(sentences);

    // Select 2 or 3 sentences, to add to the random feel
    var num_s = Math.floor(Math.random() * 2) + 2;
    sentences = sentences.slice(0, num_s);
    sentences = sentences.join(" ");

    sentences += " " + _sentence_mgr2.default.datePredict();

    debug(sentences);
    return sentences;
  }
352798
def make_data(n,m):
    """"""
    p = {}
    for i in range(1,m+1):
        for j in range(1,n+1):
            p[i,j] = random.randint(1,10)
    return p
934462
def setup_random_structure(self, coordination):
        
        aa = 0.4
        bb = -0.2
        coords = list()
        for ii in range(coordination + 1):
            coords.append(aa * np.random.random_sample(3, ) + bb)
        self.set_structure(
            lattice=np.array([[10, 0, 0], [0, 10, 0], [0, 0, 10]], np.float),
            species=["Si"] * (coordination + 1),
            coords=coords,
            coords_are_cartesian=False)
        self.setup_random_indices_local_geometry(coordination)