Generate n numbers as a list or a single one if no n is given.

        n is used to minimize the number of requests made and return type changes to be compatible
        with :py:mod:`random`'s interface
778566
def randint(self, a: int, b: int, n: Optional[int] = None) -> Union[List[int], int]:
        
        max_n = self.config.MAX_NUMBER_OF_INTEGERS
        return self._generate_randoms(self._request_randints, max_n=max_n, a=a, b=b, n=n)
1362961
def sample(self, n):
        
        rg = self._ctx._jvm.org.apache.commons.math3.random.JDKRandomGenerator()
        return _java2py(self._ctx, self._jmodel.sample(n, rg))
67058
def generate_dataset(number_items=1000):
    
    data = []
    names = get_names()
    totalnames = len(names)
    #init random seeder
    random.seed()
    #calculate items
#    names = random.sample(names, number_items)
    for i in range(number_items):
        data.append({"name":names[random.randint(0,totalnames-1)],
                     "age":random.randint(1,100),
                     "description":li_words(50, False)})
    return data
713467
def resample(self,N):
        
        inds = rand.randint(len(self.samples),size=N)
        return self.samples[inds]
275749
public static int nextInt(int n)
  {
    Random random = getRandom();

    int value = random.nextInt(n);

    if (! _isTest)
      _freeRandomList.free(random);

    return value;
  }
372032
def inc_n(self, n, exception=None):  # type: (int, Optional[ParseError]) -> bool
        
        return self._src.inc_n(n=n, exception=exception)
1220481
function randomNumber() {
  var min = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  var max = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;

  return Math.floor(Math.random() * (max - min + 1)) + min;
}
954688
def resample(self,N):
        
        return rand.random(size=N)*(self.maxval - self.minval) + self.minval
318125
def writeNumber(self, n):
        
        self.writeType(TYPE_NUMBER)
        self.stream.write_double(float(n))
1226916
def Sample(self, n):
        
        size = n,
        return numpy.random.beta(self.alpha, self.beta, size)
796785
def _choice(rand_gen: Callable[[], float], sequence: Sequence[T]) -> T:
    
    return sequence[int(rand_gen() * len(sequence))]
658174
def _generate_permutation(self, npoints):
        
        i = np.arange(0, npoints)
        # permutation
        p = np.random.permutation(npoints)
        ip = np.empty_like(p)
        # inverse permutation
        ip[p[i]] = i
        return p, ip
404905
def generate_random_type(valid):
    
    type = choice(['int', 'str'])

    r = lambda: randrange(-1000000000, 1000000000)

    if type == 'int':
        return int,  (r() if valid else str(r()) for i in itertools.count())
    elif type == 'str':
        return str, (str(r()) if valid else r() for i in itertools.count())
    else:
        raise AssertionError('!')
1292452
def floats(self, n: int = 2) -> List[float]:
        
        nums = [self.random.random()
                for _ in range(10 ** int(n))]
        return nums
705287
def setRandomParams(self):
        
        params = sp.randn(self.getNumberParams())
        self.setParams(params)
728449
def generateSequences(n=2048, w=40, sequenceLength=5, sequenceCount=2,
                      sharedRange=None, seed=42):
  
  # Lots of room for noise sdrs
  patternAlphabetSize = 10*(sequenceLength * sequenceCount)
  patternMachine = PatternMachine(n, w, patternAlphabetSize, seed)
  sequenceMachine = SequenceMachine(patternMachine, seed)
  numbers = sequenceMachine.generateNumbers(sequenceCount, sequenceLength,
                                            sharedRange=sharedRange )
  generatedSequences = sequenceMachine.generateFromNumbers(numbers)

  return sequenceMachine, generatedSequences, numbers
710342
def setRandomParams(self):
        
        params = SP.randn(self.getNumberParams())
        self.setParams(params)