Generate a random function that is seeded with the given value.
488400
function generator(seed) {
    // Note: the generator didn't work with negative seed values, so here we
    // transform our original seed into a new (positive) seed value with which we
    // create a new generator.
    if (seed < 0) {
        var gen = generator(Math.abs(seed));
        for (var i = 0; i < 23; i += 1) {
            gen();
        }
        return generator(gen(0, 10000));
    }

    // Based on random number generator from
    // http://indiegamr.com/generate-repeatable-random-numbers-in-js/
    return function (min, max) {
        min = min || 0;
        max = max || 1;
        seed = (seed * 9301 + 49297) % 233280;
        var v = seed / 233280;
        return min + v * (max - min);
    };
}
1241522
def init_random(X, n_clusters, random_state):
    """"""
    logger.info("Initializing randomly")
    idx = sorted(draw_seed(random_state, 0, len(X), size=n_clusters))
    centers = X[idx].compute()
    return centers
150756
def generate(cls):
        
        return cls(
            random(nacl.bindings.crypto_sign_SEEDBYTES),
            encoder=encoding.RawEncoder,
        )
1115211
def get_random_number_generator_and_set_seed(seed=None):
  """"""
  random.seed(seed)
  # While python random accepts None as seed and uses time/os seed then,
  # some other functions expect integers so we create one here.
  if seed is None:
    seed = random.randint(0, 2**31 - 1)
  tf.set_random_seed(seed)
  numpy.random.seed(seed)
  return jax_random.get_prng(seed)
1023870
def simulate(self):
        """"""
        min_ = (-sys.maxsize - 1) if self._min is None else self._min
        max_ = sys.maxsize if self._max is None else self._max
        return random.randint(min_, max_)
432706
def setSeed(self, value):
        
        self.seed = value
        random.seed(self.seed)
        if self.verbosity >= 0:
            print("Conx using seed:", self.seed)
481832
private SecureRandom createSecureRandom() {
        SecureRandom result;
        try {
            result = SecureRandom.getInstance("SHA1PRNG");
        } catch (NoSuchAlgorithmException e) {
            result = new SecureRandom();
        }

        // Force seeding to take place.
        result.nextInt();
        return result;
    }
1143530
function seedRandom(buffer) {
  if (!(buffer instanceof Uint8Array)) {
    buffer = new Uint8Array(buffer);
  }
  openpgp.crypto.random.randomBuffer.set(buffer);
}
843868
public static MutableDoubleTuple createRandom(int size, Random random)
    {
       MutableDoubleTuple t = create(size);
       randomize(t, random);
       return t;
    }
1127783
def get_random_value(field):
    
    func = get_factory_func(field)

    if field.default is not None:
        if callable(field.default):
            return field.default()
        return field.default

    if field.choices:
        return random.choice(field.choices)

    return func(field)
97478
def set_seed(seed: int):
    
    random.seed(seed)
    np.random.seed(seed)
    torch.random.manual_seed(seed)
672378
def generate(self):
        """"""
        x, y, z = self.point1
        return (x + self.size_x * random(),
                y + self.size_y * random(),
                z + self.size_z * random())
29764
def create(deg, p=0.75, mode='x', tags=None):
    
    return RandomRotate(deg, p, mode, tags)
224288
def random_seed(seed=42):
    
    old_state = random.getstate()
    random.seed(seed)
    try:
        yield
    finally:
        random.setstate(old_state)
1235068
def const_rand(size, seed=23980):
    
    old_seed = np.random.seed()
    np.random.seed(seed)
    out = np.random.rand(size)
    np.random.seed(old_seed)
    return out
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)
    ]
457364
def somenan(self, x, fun, p=0.1):
        """"""
        if np.random.rand(1) < p:
            return np.NaN
        else:
            return fun(x)