NZMATH
1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
![]() ![]() |
Functions | |
def | randrange (start, stop=None, step=1) |
def | _validate_for_randrange (start, stop, step) |
def | map_choice (mapping, upperbound) |
Variables | |
random = _random.random | |
seed = _random.seed | |
list | __all__ = ['random', 'randrange', 'seed', 'map_choice'] |
|
private |
Check validity of arguments for randrange.
Definition at line 49 of file bigrandom.py.
Referenced by nzmath.bigrandom.randrange().
def nzmath.bigrandom.map_choice | ( | mapping, | |
upperbound | |||
) |
Return a choice from a set given as the image of the mapping from natural numbers (more precisely range(upperbound)). In other words, it is equivalent to random.choice([mapping(i) for i in range(upperboud) if mapping(i) != None]) if upperbound is small enough for the list size limit. The mapping can be a partial function, i.e. it may return None for some input. However, if the resulting set is empty, it will end up with an infinite loop.
Definition at line 68 of file bigrandom.py.
References nzmath.bigrandom.randrange().
def nzmath.bigrandom.randrange | ( | start, | |
stop = None , |
|||
step = 1 |
|||
) |
Choose a random item from range([start,] stop[, step]). (Return long integer.) see random.randrange
Definition at line 8 of file bigrandom.py.
References nzmath.bigrandom._validate_for_randrange(), nzmath.bigrandom.random, and nzmath.bigrange.range().
Referenced by nzmath.bigrandom.map_choice().
|
private |
Definition at line 86 of file bigrandom.py.
nzmath.bigrandom.random = _random.random |
Definition at line 64 of file bigrandom.py.
Referenced by nzmath.bigrandom.randrange().
nzmath.bigrandom.seed = _random.seed |
Definition at line 65 of file bigrandom.py.