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

type WichmannHill

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

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

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

Inherited from Random (private): _randbelow

Inherited from _random.Random: __getattribute__, __new__, getrandbits

Class Variables [hide private]
  VERSION = 1
Method Details [hide private]

seed(self, a=None)

 

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

random(self)

 

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

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

getstate(self)

 

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

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

setstate(self, state)

 

Restore internal state from object returned by getstate().

Returns: None
Overrides: _random.Random.setstate

jumpahead(self, n)

 
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

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

 

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

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

whseed(self, a=None)

 

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.