Copyright (C) 2000-2012 |
GNU Info (python2.1-lib.info)whrandomPseudo-random number generator ============================== Floating point pseudo-random number generator. _This is deprecated in Python 2.1. Use `random' instead._ *Note:* This module was an implementation detail of the `random' module in releases of Python prior to 2.1. It is no longer used. Please do not use this module directly; use `random' instead. This module implements a Wichmann-Hill pseudo-random number generator class that is also named `whrandom'. Instances of the `whrandom' class conform to the Random Number Generator interface described in section . They also offer the following method, specific to the Wichmann-Hill algorithm: `seed([x, y, z])' Initializes the random number generator from the integers X, Y and Z. When the module is first imported, the random number is initialized using values derived from the current time. If X, Y, and Z are either omitted or `0', the seed will be computed from the current system time. If one or two of the parameters are `0', but not all three, the zero values are replaced by ones. This causes some apparently different seeds to be equal, with the corresponding result on the pseudo-random series produced by the generator. `choice(seq)' Chooses a random element from the non-empty sequence SEQ and returns it. `randint(a, b)' Returns a random integer N such that `A<=N<=B'. `random()' Returns the next random floating point number in the range [0.0 ... 1.0). `seed(x, y, z)' Initializes the random number generator from the integers X, Y and Z. When the module is first imported, the random number is initialized using values derived from the current time. `uniform(a, b)' Returns a random real number N such that `A<=N<B'. When imported, the `whrandom' module also creates an instance of the `whrandom' class, and makes the methods of that instance available at the module level. Therefore one can write either `N = whrandom.random()' or: generator = whrandom.whrandom() N = generator.random() Note that using separate instances of the generator leads to independent sequences of pseudo-random numbers. See also: Note: random Generators for various random distributions and documentation for the Random Number Generator interface. Wichmann, B. A. & Hill, I. D., "Algorithm AS 183: An efficient and portable pseudo-random number generator", 31 (1982) 188-190. automatically generated by info2www version 1.2.2.9 |