bundles / numpy 2.4.3 / numpy / random / _generator / Generator
class
numpy.random._generator:Generator
source: /numpy/random/_generator.cpython-314-x86_64-linux-gnu.so
Signature
class Generator ( bit_generator ) Members
-
__getstate__ -
__reduce__ -
__setstate__ -
beta -
binomial -
bytes -
chisquare -
choice -
dirichlet -
exponential -
f -
gamma -
geometric -
gumbel -
hypergeometric -
integers -
laplace -
logistic -
lognormal -
logseries -
multinomial -
multivariate_hypergeometric -
multivariate_normal -
negative_binomial -
noncentral_chisquare -
noncentral_f -
normal -
pareto -
permutation -
permuted -
poisson -
power -
random -
rayleigh -
shuffle -
spawn -
standard_cauchy -
standard_exponential -
standard_gamma -
standard_normal -
standard_t -
triangular -
uniform -
vonmises -
wald -
weibull -
zipf
Summary
Container for the BitGenerators.
Extended Summary
Generator exposes a number of methods for generating random numbers drawn from a variety of probability distributions. In addition to the distribution-specific arguments, each method takes a keyword argument size that defaults to None. If size is None, then a single value is generated and returned. If size is an integer, then a 1-D array filled with generated values is returned. If size is a tuple, then an array with that shape is filled and returned.
The function numpy.random.default_rng will instantiate a Generator with numpy's default BitGenerator.
No Compatibility Guarantee
Generator does not provide a version compatibility guarantee. In particular, as better algorithms evolve the bit stream may change.
Parameters
bit_generator: BitGeneratorBitGenerator to use as the core generator.
Notes
The Python stdlib module random contains pseudo-random number generator with a number of methods that are similar to the ones available in Generator. It uses Mersenne Twister, and this bit generator can be accessed using MT19937. Generator, besides being NumPy-aware, has the advantage that it provides a much larger number of probability distributions to choose from.
Examples
from numpy.random import Generator, PCG64 rng = Generator(PCG64())✓
rng.standard_normal()
✗See also
- default_rng
Recommended constructor for
Generator.
Aliases
-
numpy.random.Generator
Referenced by
This package
- release:1.18.0-notes
- numpy.random:RandomState.beta
- numpy.random:RandomState.binomial
- numpy.random:RandomState.bytes
- numpy.random:RandomState.chisquare
- numpy.random:RandomState.choice
- numpy.random:RandomState.dirichlet
- numpy.random:RandomState.exponential
- numpy.random:RandomState.f
- numpy.random:RandomState.gamma
- numpy.random:RandomState.geometric
- numpy.random:RandomState.gumbel
- numpy.random:RandomState.hypergeometric
- numpy.random:RandomState.laplace
- numpy.random:RandomState.logistic
- numpy.random:RandomState.lognormal
- numpy.random:RandomState.logseries
- numpy.random:RandomState.multinomial
- numpy.random:RandomState.multivariate_normal
- numpy.random:RandomState.negative_binomial
- numpy.random:RandomState.noncentral_chisquare
- numpy.random:RandomState.noncentral_f
- numpy.random:RandomState.normal
- numpy.random:RandomState.pareto
- numpy.random:RandomState.permutation
- numpy.random:RandomState.poisson
- numpy.random:RandomState.power
- numpy.random:RandomState.randint
- numpy.random:RandomState.randn
- numpy.random:RandomState.random_sample
- numpy.random:RandomState.rayleigh
- numpy.random:RandomState.shuffle
- numpy.random:RandomState.standard_cauchy
- numpy.random:RandomState.standard_exponential
- numpy.random:RandomState.standard_gamma
- numpy.random:RandomState.standard_normal
- numpy.random:RandomState.standard_t
- numpy.random:RandomState.triangular
- numpy.random:RandomState.uniform
- numpy.random:RandomState.vonmises
- numpy.random:RandomState.wald
- numpy.random:RandomState.weibull
- numpy.random:RandomState.zipf
- release:1.18.0-notes
- numpy.random:RandomState.beta
- numpy.random:RandomState.binomial
- numpy.random:RandomState.bytes
- numpy.random:RandomState.chisquare
- numpy.random:RandomState.choice
- numpy.random:RandomState.dirichlet
- numpy.random:RandomState.exponential
- numpy.random:RandomState.f
- numpy.random:RandomState.gamma
- numpy.random:RandomState.geometric
- numpy.random:RandomState.gumbel
- numpy.random:RandomState.hypergeometric
- numpy.random:RandomState.laplace
- numpy.random:RandomState.logistic
- numpy.random:RandomState.lognormal
- numpy.random:RandomState.logseries
- numpy.random:RandomState.multinomial
- numpy.random:RandomState.multivariate_normal
- numpy.random:RandomState.negative_binomial
- numpy.random:RandomState.noncentral_chisquare
- numpy.random:RandomState.noncentral_f
- numpy.random:RandomState.normal
- numpy.random:RandomState.pareto
- numpy.random:RandomState.permutation
- numpy.random:RandomState.poisson
- numpy.random:RandomState.power
- numpy.random:RandomState.randint
- numpy.random:RandomState.randn
- numpy.random:RandomState.random_sample
- numpy.random:RandomState.rayleigh
- numpy.random:RandomState.shuffle
- numpy.random:RandomState.standard_cauchy
- numpy.random:RandomState.standard_exponential
- numpy.random:RandomState.standard_gamma
- numpy.random:RandomState.standard_normal
- numpy.random:RandomState.standard_t
- numpy.random:RandomState.triangular
- numpy.random:RandomState.uniform
- numpy.random:RandomState.vonmises
- numpy.random:RandomState.wald
- numpy.random:RandomState.weibull
- numpy.random:RandomState.zipf
- release:1.18.0-notes
- numpy.random:RandomState.beta
- numpy.random:RandomState.binomial
- numpy.random:RandomState.bytes
- numpy.random:RandomState.chisquare
- numpy.random:RandomState.choice
- numpy.random:RandomState.dirichlet
- numpy.random:RandomState.exponential
- numpy.random:RandomState.f
- numpy.random:RandomState.gamma
- numpy.random:RandomState.geometric
- numpy.random:RandomState.gumbel
- numpy.random:RandomState.hypergeometric
- numpy.random:RandomState.laplace
- numpy.random:RandomState.logistic
- numpy.random:RandomState.lognormal
- numpy.random:RandomState.logseries
- numpy.random:RandomState.multinomial
- numpy.random:RandomState.multivariate_normal
- numpy.random:RandomState.negative_binomial
- numpy.random:RandomState.noncentral_chisquare
- numpy.random:RandomState.noncentral_f
- numpy.random:RandomState.normal
- numpy.random:RandomState.pareto
- numpy.random:RandomState.permutation
- numpy.random:RandomState.poisson
- numpy.random:RandomState.power
- numpy.random:RandomState.randint
- numpy.random:RandomState.randn
- numpy.random:RandomState.random_sample
- numpy.random:RandomState.rayleigh
- numpy.random:RandomState.shuffle
- numpy.random:RandomState.standard_cauchy
- numpy.random:RandomState.standard_exponential
- numpy.random:RandomState.standard_gamma
- numpy.random:RandomState.standard_normal
- numpy.random:RandomState.standard_t
- numpy.random:RandomState.triangular
- numpy.random:RandomState.uniform
- numpy.random:RandomState.vonmises
- numpy.random:RandomState.wald
- numpy.random:RandomState.weibull
- numpy.random:RandomState.zipf
Other packages
- scipy tutorial:stats:probability_distributions
- scipy tutorial:stats:quasi_monte_carlo
- scipy scipy.cluster.vq:kmeans
- scipy scipy.cluster.vq:kmeans2
- scipy scipy.interpolate._polyint:barycentric_interpolate
- scipy scipy.interpolate._polyint:BarycentricInterpolator
- scipy scipy.linalg._sketches:clarkson_woodruff_transform
- scipy scipy.linalg._sketches:cwt_matrix
- scipy scipy.linalg.interpolative
- scipy scipy.linalg.interpolative:estimate_rank
- scipy scipy.linalg.interpolative:estimate_spectral_norm
- scipy scipy.linalg.interpolative:estimate_spectral_norm_diff
- scipy scipy.linalg.interpolative:interp_decomp
- scipy scipy.linalg.interpolative:svd
- scipy scipy.optimize._basinhopping:basinhopping
- scipy scipy.optimize._differentialevolution:differential_evolution
- scipy scipy.optimize._differentialevolution:DifferentialEvolutionSolver
- scipy scipy.optimize._dual_annealing:dual_annealing
- scipy scipy.optimize._dual_annealing:VisitingDistribution
- scipy scipy.optimize._optimize:check_grad
- scipy scipy.sparse._construct:rand
- scipy scipy.sparse._construct:random
- scipy scipy.sparse._construct:random_array
- scipy scipy.sparse.linalg._eigen._svds:svds
- scipy scipy.sparse.linalg._eigen.arpack.arpack:eigs
- scipy scipy.sparse.linalg._eigen.arpack.arpack:eigsh
- scipy scipy.sparse.linalg._svdp:_svdp
- scipy scipy.spatial.distance:directed_hausdorff
- scipy scipy.spatial.transform._rotation:Rotation.random
- scipy scipy.stats._fit:goodness_of_fit
- scipy scipy.stats._kde:gaussian_kde.integrate_box
- scipy scipy.stats._multicomp:dunnett
- scipy scipy.stats._multivariate:invwishart_frozen.__init__
- scipy scipy.stats._probability_distribution:_ProbabilityDistribution.sample
- scipy scipy.stats._qmc:_van_der_corput_permutations
- scipy scipy.stats._qmc:check_random_state
- scipy scipy.stats._qmc:Halton
- scipy scipy.stats._qmc:LatinHypercube
- scipy scipy.stats._qmc:MultinomialQMC
- scipy scipy.stats._qmc:MultivariateNormalQMC
- scipy scipy.stats._qmc:PoissonDisk
- scipy scipy.stats._qmc:QMCEngine
- scipy scipy.stats._qmc:Sobol
- scipy scipy.stats._qmc:van_der_corput
- scipy scipy.stats._resampling:BootstrapMethod
- scipy scipy.stats._resampling:MonteCarloMethod
- scipy scipy.stats._resampling:permutation_test
- scipy scipy.stats._resampling:PermutationMethod
- scipy scipy.stats._sensitivity_analysis:sobol_indices