NZMATH  1.2.0
About: NZMATH is a Python based number theory oriented calculation system.
  Fossies Dox: NZMATH-1.2.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

nzmath.bigrandom Namespace Reference

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']
 

Function Documentation

◆ _validate_for_randrange()

def nzmath.bigrandom._validate_for_randrange (   start,
  stop,
  step 
)
private
Check validity of arguments for randrange.

Definition at line 49 of file bigrandom.py.

Referenced by nzmath.bigrandom.randrange().

◆ map_choice()

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().

◆ 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().

Variable Documentation

◆ __all__

list nzmath.bigrandom.__all__ = ['random', 'randrange', 'seed', 'map_choice']
private

Definition at line 86 of file bigrandom.py.

◆ random

nzmath.bigrandom.random = _random.random

Definition at line 64 of file bigrandom.py.

Referenced by nzmath.bigrandom.randrange().

◆ seed

nzmath.bigrandom.seed = _random.seed

Definition at line 65 of file bigrandom.py.