Randomize a sequence of integers.
2987
def sequence(minimum, maximum):
    """"""
    function = 'sequences'
    opts = {'min': minimum,
            'max': maximum,
            'col': 1,
            'format': 'plain',
            'rnd': 'new'}
    deal = get_http(RANDOM_URL, function, opts)
    deal_arr = str_to_arr(deal)
    return deal_arr
1255014
def _roll_random(rng, n):
    ""
    bits = util.bit_length(n-1)
    bytes = (bits + 7) // 8
    hbyte_mask = pow(2, bits % 8) - 1

    # so here's the plan:
    # we fetch as many random bits as we'd need to fit N-1, and if the
    # generated number is >= N, we try again.  in the worst case (N-1 is a
    # power of 2), we have slightly better than 50% odds of getting one that
    # fits, so i can't guarantee that this loop will ever finish, but the odds
    # of it looping forever should be infinitesimal.
    while True:
        x = rng.read(bytes)
        if hbyte_mask > 0:
            x = chr(ord(x[0]) & hbyte_mask) + x[1:]
        num = util.inflate_long(x, 1)
        if num < n:
            break
    return num
71139
def DiscreteUniform(n=10,LB=1,UB=99,B=100):
    """"""
    B = 100
    s = [0]*n
    for i in range(n):
        s[i] = random.randint(LB,UB)
    return s,B
109886
def uniform_int(low:int, high:int, size:Optional[List[int]]=None)->IntOrTensor:
    ""
    return random.randint(low,high) if size is None else torch.randint(low,high+1,size)
220737
def random(self, n: Optional[int] = None) -> Union[List[float], float]:
        
        return self._generate_randoms(self._request_randoms, max_n=self.config.MAX_NUMBER_OF_FLOATS,
                                      n=n)
806479
def randomizeOrder(self):
        
        flag = [0] * len(self.inputs)
        self.loadOrder = [0] * len(self.inputs)
        for i in range(len(self.inputs)):
            pos = int(random.random() * len(self.inputs))
            while (flag[pos] == 1):
                pos = int(random.random() * len(self.inputs))
            flag[pos] = 1
            self.loadOrder[pos] = i
148007
def randombytes(n):
    """"""
    # Use /dev/urandom if it is available.  Fall back to random module
    # if not.  It might be worthwhile to extend this function to use
    # other platform-specific mechanisms for getting random bytes.
    if os.path.exists("/dev/urandom"):
        f = open("/dev/urandom")
        s = f.read(n)
        f.close()
        return s
    else:
        L = [chr(random.randrange(0, 256)) for i in range(n)]
        return "".join(L)
357313
def random_partition(n, n_data):
    """"""
    all_idxs = np.arange(n_data)
    np.random.shuffle(all_idxs)
    idxs1 = all_idxs[:n]
    idxs2 = all_idxs[n:]
    return idxs1, idxs2
726455
def random(game):
    '''
    
    '''
    game.valid_moves = tuple(sorted(game.valid_moves, key=lambda _: rand.random()))
750014
def random_flip(sequence,rnum=None):
  """"""
  randin = rnum
  if not randin: randin = RandomSource()
  if randin.random() < 0.5:
    return rc(sequence)
  return sequence
902974
@Override
  public void randomize(int randomSeed) {
    Random rand = new Random(randomSeed);
    for(int j = size - 1; j > 0; j --){
      int randIndex = rand.nextInt(j);
      
      int [] tmp = data[randIndex];
      data[randIndex] = data[j];
      data[j] = tmp;
      
      int tmpl = labels[randIndex];
      labels[randIndex] = labels[j];
      labels[j] = tmpl;
      
      float tmpw = weights[randIndex];
      weights[randIndex] = weights[j];
      weights[j] = tmpw;
    }
  }
796785
def _choice(rand_gen: Callable[[], float], sequence: Sequence[T]) -> T:
    
    return sequence[int(rand_gen() * len(sequence))]
236266
public void randomize() {
		numKnots = 4 + (int)(6*Math.random());
		xKnots = new int[numKnots];
		yKnots = new int[numKnots];
		knotTypes = new byte[numKnots];
		for (int i = 0; i < numKnots; i++) {
			xKnots[i] = (int)(255 * Math.random());
			yKnots[i] = 0xff000000 | ((int)(255 * Math.random()) << 16) | ((int)(255 * Math.random()) << 8) | (int)(255 * Math.random());
			knotTypes[i] = RGB|SPLINE;
		}
		xKnots[0] = -1;
		xKnots[1] = 0;
		xKnots[numKnots-2] = 255;
		xKnots[numKnots-1] = 256;
		sortKnots();
		rebuildGradient();
	}
1141384
def _random(self, key):
        """"""

        if hasattr(key, "encode"):
            key = key.encode('ascii')

        value = (zlib.crc32(key, self.seed) & MAX_VALUE)

        return value * INV_MAX_VALUE
860877
def randomize_args(self):
        '''
        '''
        args = self.spiro_args + np.random.normal(0, self.move_radius,
                                                  self.spiro_args.shape)
        np.clip(args, -199, 199, args)
        while args[0] == 0 or args[1] == 0:
            args = self.spiro_args + np.random.normal(0, self.move_radius,
                                                      self.spiro_args.shape)
            np.clip(args, -199, 199, args)
        return args
160313
def random_real_solution(solution_size, lower_bounds, upper_bounds):
    """"""
    return [
        random.uniform(lower_bounds[i], upper_bounds[i])
        for i in range(solution_size)
    ]
875407
def createRandomSequences(self,
                          numSequences,
                          sequenceLength):
    
    for _ in xrange(numSequences):
      self.addObject(
        [numpy.random.randint(0, self.numFeatures)
                                            for _ in xrange(sequenceLength)]
      )