brainpy.math.random: Random Number Generations

brainpy.math.random: Random Number Generations#

Random Sampling Functions#

seed

Sets a new random seed.

split_key

Create a new seed from the current seed.

split_keys

Create multiple seeds from the current seed.

default_rng

rtype:

RandomState

rand

Random values in a given shape.

randint

Return random integers from low (inclusive) to high (exclusive).

random_integers

Random integers of type np.int_ between low and high, inclusive.

randn

Return a sample (or samples) from the "standard normal" distribution.

random

Return random floats in the half-open interval [0.0, 1.0).

random_sample

Return random floats in the half-open interval [0.0, 1.0).

ranf

This is an alias of random_sample.

sample

This is an alias of random_sample.

choice

Generates a random sample from a given 1-D array

permutation

Randomly permute a sequence, or return a permuted range.

shuffle

Modify a sequence in-place by shuffling its contents.

beta

Draw samples from a Beta distribution.

exponential

Draw samples from an exponential distribution.

gamma

Draw samples from a Gamma distribution.

gumbel

Draw samples from a Gumbel distribution.

laplace

Draw samples from the Laplace or double exponential distribution with specified location (or mean) and scale (decay).

logistic

Draw samples from a logistic distribution.

normal

Draw random samples from a normal (Gaussian) distribution.

pareto

Draw samples from a Pareto II or Lomax distribution with specified shape.

poisson

Draw samples from a Poisson distribution.

standard_cauchy

Draw samples from a standard Cauchy distribution with mode = 0.

standard_exponential

Draw samples from the standard exponential distribution.

standard_gamma

Draw samples from a standard Gamma distribution.

standard_normal

Draw samples from a standard Normal distribution (mean=0, stdev=1).

standard_t

Draw samples from a standard Student's t distribution with df degrees of freedom.

uniform

Draw samples from a uniform distribution.

truncated_normal

Sample truncated standard normal random values with given shape and dtype.

bernoulli

Sample Bernoulli random values with given shape and mean.

lognormal

Draw samples from a log-normal distribution.

binomial

Draw samples from a binomial distribution.

chisquare

Draw samples from a chi-square distribution.

dirichlet

Draw samples from the Dirichlet distribution.

geometric

Draw samples from the geometric distribution.

f

Draw samples from an F distribution.

hypergeometric

Draw samples from a Hypergeometric distribution.

logseries

Draw samples from a logarithmic series distribution.

multinomial

Draw samples from a multinomial distribution.

multivariate_normal

Draw random samples from a multivariate normal distribution.

negative_binomial

Draw samples from a negative binomial distribution.

noncentral_chisquare

Draw samples from a noncentral chi-square distribution.

noncentral_f

Draw samples from the noncentral F distribution.

power

Draws samples in [0, 1] from a power distribution with positive exponent a - 1.

rayleigh

Draw samples from a Rayleigh distribution.

triangular

Draw samples from the triangular distribution over the interval [left, right].

vonmises

Draw samples from a von Mises distribution.

wald

Draw samples from a Wald, or inverse Gaussian, distribution.

weibull

Draw samples from a Weibull distribution.

weibull_min

Sample from a Weibull distribution.

zipf

Draw samples from a Zipf distribution.

maxwell

Sample from a one sided Maxwell distribution.

t

Sample Student’s t random values.

orthogonal

Sample uniformly from the orthogonal group O(n).

loggamma

Sample log-gamma random values.

categorical

Sample random values from categorical distributions.

rand_like

Similar to rand_like in torch.

randint_like

Similar to randint_like in torch.

randn_like

Similar to randn_like in torch.

Random Generator#

RandomState

RandomState that track the random generator state.

Generator

alias of RandomState

DEFAULT

RandomState that track the random generator state.