Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/numpy/random/__init__.py: 94%

17 statements  

« prev     ^ index     » next       coverage.py v6.4.4, created at 2023-07-17 14:22 -0600

1""" 

2======================== 

3Random Number Generation 

4======================== 

5 

6Use ``default_rng()`` to create a `Generator` and call its methods. 

7 

8=============== ========================================================= 

9Generator 

10--------------- --------------------------------------------------------- 

11Generator Class implementing all of the random number distributions 

12default_rng Default constructor for ``Generator`` 

13=============== ========================================================= 

14 

15============================================= === 

16BitGenerator Streams that work with Generator 

17--------------------------------------------- --- 

18MT19937 

19PCG64 

20PCG64DXSM 

21Philox 

22SFC64 

23============================================= === 

24 

25============================================= === 

26Getting entropy to initialize a BitGenerator 

27--------------------------------------------- --- 

28SeedSequence 

29============================================= === 

30 

31 

32Legacy 

33------ 

34 

35For backwards compatibility with previous versions of numpy before 1.17, the 

36various aliases to the global `RandomState` methods are left alone and do not 

37use the new `Generator` API. 

38 

39==================== ========================================================= 

40Utility functions 

41-------------------- --------------------------------------------------------- 

42random Uniformly distributed floats over ``[0, 1)`` 

43bytes Uniformly distributed random bytes. 

44permutation Randomly permute a sequence / generate a random sequence. 

45shuffle Randomly permute a sequence in place. 

46choice Random sample from 1-D array. 

47==================== ========================================================= 

48 

49==================== ========================================================= 

50Compatibility 

51functions - removed 

52in the new API 

53-------------------- --------------------------------------------------------- 

54rand Uniformly distributed values. 

55randn Normally distributed values. 

56ranf Uniformly distributed floating point numbers. 

57random_integers Uniformly distributed integers in a given range. 

58 (deprecated, use ``integers(..., closed=True)`` instead) 

59random_sample Alias for `random_sample` 

60randint Uniformly distributed integers in a given range 

61seed Seed the legacy random number generator. 

62==================== ========================================================= 

63 

64==================== ========================================================= 

65Univariate 

66distributions 

67-------------------- --------------------------------------------------------- 

68beta Beta distribution over ``[0, 1]``. 

69binomial Binomial distribution. 

70chisquare :math:`\\chi^2` distribution. 

71exponential Exponential distribution. 

72f F (Fisher-Snedecor) distribution. 

73gamma Gamma distribution. 

74geometric Geometric distribution. 

75gumbel Gumbel distribution. 

76hypergeometric Hypergeometric distribution. 

77laplace Laplace distribution. 

78logistic Logistic distribution. 

79lognormal Log-normal distribution. 

80logseries Logarithmic series distribution. 

81negative_binomial Negative binomial distribution. 

82noncentral_chisquare Non-central chi-square distribution. 

83noncentral_f Non-central F distribution. 

84normal Normal / Gaussian distribution. 

85pareto Pareto distribution. 

86poisson Poisson distribution. 

87power Power distribution. 

88rayleigh Rayleigh distribution. 

89triangular Triangular distribution. 

90uniform Uniform distribution. 

91vonmises Von Mises circular distribution. 

92wald Wald (inverse Gaussian) distribution. 

93weibull Weibull distribution. 

94zipf Zipf's distribution over ranked data. 

95==================== ========================================================= 

96 

97==================== ========================================================== 

98Multivariate 

99distributions 

100-------------------- ---------------------------------------------------------- 

101dirichlet Multivariate generalization of Beta distribution. 

102multinomial Multivariate generalization of the binomial distribution. 

103multivariate_normal Multivariate generalization of the normal distribution. 

104==================== ========================================================== 

105 

106==================== ========================================================= 

107Standard 

108distributions 

109-------------------- --------------------------------------------------------- 

110standard_cauchy Standard Cauchy-Lorentz distribution. 

111standard_exponential Standard exponential distribution. 

112standard_gamma Standard Gamma distribution. 

113standard_normal Standard normal distribution. 

114standard_t Standard Student's t-distribution. 

115==================== ========================================================= 

116 

117==================== ========================================================= 

118Internal functions 

119-------------------- --------------------------------------------------------- 

120get_state Get tuple representing internal state of generator. 

121set_state Set state of generator. 

122==================== ========================================================= 

123 

124 

125""" 

126__all__ = [ 

127 'beta', 

128 'binomial', 

129 'bytes', 

130 'chisquare', 

131 'choice', 

132 'dirichlet', 

133 'exponential', 

134 'f', 

135 'gamma', 

136 'geometric', 

137 'get_state', 

138 'gumbel', 

139 'hypergeometric', 

140 'laplace', 

141 'logistic', 

142 'lognormal', 

143 'logseries', 

144 'multinomial', 

145 'multivariate_normal', 

146 'negative_binomial', 

147 'noncentral_chisquare', 

148 'noncentral_f', 

149 'normal', 

150 'pareto', 

151 'permutation', 

152 'poisson', 

153 'power', 

154 'rand', 

155 'randint', 

156 'randn', 

157 'random', 

158 'random_integers', 

159 'random_sample', 

160 'ranf', 

161 'rayleigh', 

162 'sample', 

163 'seed', 

164 'set_state', 

165 'shuffle', 

166 'standard_cauchy', 

167 'standard_exponential', 

168 'standard_gamma', 

169 'standard_normal', 

170 'standard_t', 

171 'triangular', 

172 'uniform', 

173 'vonmises', 

174 'wald', 

175 'weibull', 

176 'zipf', 

177] 

178 

179# add these for module-freeze analysis (like PyInstaller) 

180from . import _pickle 

181from . import _common 

182from . import _bounded_integers 

183 

184from ._generator import Generator, default_rng 

185from .bit_generator import SeedSequence, BitGenerator 

186from ._mt19937 import MT19937 

187from ._pcg64 import PCG64, PCG64DXSM 

188from ._philox import Philox 

189from ._sfc64 import SFC64 

190from .mtrand import * 

191 

192__all__ += ['Generator', 'RandomState', 'SeedSequence', 'MT19937', 

193 'Philox', 'PCG64', 'PCG64DXSM', 'SFC64', 'default_rng', 

194 'BitGenerator'] 

195 

196 

197def __RandomState_ctor(): 

198 """Return a RandomState instance. 

199 

200 This function exists solely to assist (un)pickling. 

201 

202 Note that the state of the RandomState returned here is irrelevant, as this 

203 function's entire purpose is to return a newly allocated RandomState whose 

204 state pickle can set. Consequently the RandomState returned by this function 

205 is a freshly allocated copy with a seed=0. 

206 

207 See https://github.com/numpy/numpy/issues/4763 for a detailed discussion 

208 

209 """ 

210 return RandomState(seed=0) 

211 

212 

213from numpy._pytesttester import PytestTester 

214test = PytestTester(__name__) 

215del PytestTester