UserManual

bigrandom

The module provides random number generator for long integer.

historical note

The module was written for replacement of the Python standard module random, because in the era of Python 2.2 (prehistorical period of NZMATH) the random module raises OverflowError for long integer arguments for the randrange function, which is the only function having a use case in NZMATH.

After the creation of Python 2.3, it was theoretically possible to use random.randrange. Use of it is, however, not considered, since there is the bigrandom module. It is lucky for us and users. Recently, in fall of 2006, we found a bug in random.randrange and reported it; the random.randrange now accepts long integers but returns unreliable result for truly big integers.

We do not have any plans now, but if the bug will be fixed, the bigrandom module will be able to retire.

Function

randrange(start [,stop[, step]])

returns a big random integer. You may set the parameters start, stop, (this means the interval [start, stop)) and step, the increment. For example:

>>> randrange(4,10000,3) 
9919L 

Or you can ignore the last two arguments. For example:

>>> randrange(4) 
3L

Last-modified: 2006-11-08 (¿å) 22:03:38