dipy logo

Site Navigation

NIPY Community

Next topic

dipy.core.sphere

dipy.core.rng

Random number generation utilities

dipy.core.rng.LEcuyer()

Generate uniformly distributed random numbers using the 32-bit generator from figure 3 of: L’Ecuyer, P. Efficient and portable combined random number generators, C.A.C.M., vol. 31, 742-749 & 774-?, June 1988.

The cycle length is claimed to be 2.30584E+18

dipy.core.rng.WichmannHill1982()

Algorithm AS 183 Appl. Statist. (1982) vol.31, no.2

Returns a pseudo-random number rectangularly distributed between 0 and 1. The cycle length is 6.95E+12 (See page 123 of Applied Statistics (1984) vol.33), not as claimed in the original article.

ix, iy and iz should be set to integer values between 1 and 30000 before the first entry.

Integer arithmetic up to 5212632 is required.

dipy.core.rng.WichmannHill2006()

B.A. Wichmann, I.D. Hill, Generating good pseudo-random numbers, Computational Statistics & Data Analysis, Volume 51, Issue 3, 1 December 2006, Pages 1614-1622, ISSN 0167-9473, DOI: 10.1016/j.csda.2006.05.019. (http://www.sciencedirect.com/science/article/B6V8V-4K7F86W-2/2/a3a33291b8264e4c882a8f21b6e43351) for advice on generating many sequences for use together, and on alternative algorithms and codes

Examples

>>> from dipy.core import rng
>>> rng.ix, rng.iy, rng.iz, rng.it = 100001, 200002, 300003, 400004
>>> N = 1000
>>> a = [rng.WichmannHill2006() for i in range(N)]