random :: WichmannHill :: Class WichmannHill
[hide private]
[frames] | no frames]

Class WichmannHill

source code

    object --+        
             |        
_random.Random --+    
                 |    
            Random --+
                     |
                    WichmannHill

Instance Methods [hide private]
 
__whseed(self, x=0, y=0, z=0)
Set the Wichmann-Hill seed from (x, y, z).
source code
tuple containing the current state.
getstate(self)
Return internal state; can be passed to setstate() later.
source code
None
jumpahead(self, n)
Act as if n calls to random() were made, but quickly.
source code
x in the interval [0, 1).
random(self)
Get the next random number in the range [0.0, 1.0).
source code
None
seed(self, a=None)
Initialize internal state from hashable object.
source code
None
setstate(self, state)
Restore internal state from object returned by getstate().
source code
 
whseed(self, a=None)
Seed from hashable object's hash code.
source code

Inherited from Random: __getstate__, __init__, __reduce__, __setstate__, betavariate, choice, expovariate, gammavariate, gauss, lognormvariate, normalvariate, paretovariate, randint, randrange, sample, shuffle, triangular, uniform, vonmisesvariate, weibullvariate

Inherited from Random (private): _randbelow

Inherited from _random.Random: __getattribute__, __new__, getrandbits

Inherited from object: __delattr__, __format__, __hash__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  VERSION = 1
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__whseed(self, x=0, y=0, z=0)

source code 

Set the Wichmann-Hill seed from (x, y, z).

These must be integers in the range [0, 256).

getstate(self)

source code 

Return internal state; can be passed to setstate() later.

Returns: tuple containing the current state.
Overrides: _random.Random.getstate

jumpahead(self, n)

source code 
Act as if n calls to random() were made, but quickly.

n is an int, greater than or equal to 0.

Example use:  If you have 2 threads and know that each will
consume no more than a million random numbers, create two Random
objects r1 and r2, then do
    r2.setstate(r1.getstate())
    r2.jumpahead(1000000)
Then r1 and r2 will use guaranteed-disjoint segments of the full
period.

Returns: None
Overrides: _random.Random.jumpahead

random(self)

source code 

Get the next random number in the range [0.0, 1.0).

Returns: x in the interval [0, 1).
Overrides: _random.Random.random

seed(self, a=None)

source code 

Initialize internal state from hashable object.

None or no argument seeds from current time or from an operating system specific randomness source if available.

If a is not None or an int or long, hash(a) is used instead.

If a is an int or long, a is used directly. Distinct values between 0 and 27814431486575L inclusive are guaranteed to yield distinct internal states (this guarantee is specific to the default Wichmann-Hill generator).

Returns: None
Overrides: _random.Random.seed

setstate(self, state)

source code 

Restore internal state from object returned by getstate().

Returns: None
Overrides: _random.Random.setstate

whseed(self, a=None)

source code 

Seed from hashable object's hash code.

None or no argument seeds from current time. It is not guaranteed that objects with distinct hash codes lead to distinct internal states.

This is obsolete, provided for compatibility with the seed routine used prior to Python 2.1. Use the .seed() method instead.