non_uniform_random_int.NonUniformRandomInt Class Reference

Class for generating random integers between 0 (inclusive) and and upperbound (exlusive), with given probabilities. More...

List of all members.

Public Member Functions

def __init__
def make_absolute_probs_list
def calc_tables
def random
 Returns a random integer.

Public Attributes

 up_bound
 overflow


Detailed Description

Class for generating random integers between 0 (inclusive) and and upperbound (exlusive), with given probabilities.

Based on the algorithm in Donald Knuth's The Art of Programming, 2ed. V2 3.4.1.A, p.119. See also Exercise 7 (p. 139) and its solution (p. 585) of that section. [#131 #151 #597].

Author:
: Herman Tulleken
Date:
: 25 April 2009

Definition at line 20 of file non_uniform_random_int.py.


Member Function Documentation

def non_uniform_random_int.NonUniformRandomInt.__init__ (   self,
  relative_probs_list 
)

Definition at line 21 of file non_uniform_random_int.py.

def non_uniform_random_int.NonUniformRandomInt.calc_tables (   self,
  probs_list 
)

Definition at line 37 of file non_uniform_random_int.py.

def non_uniform_random_int.NonUniformRandomInt.make_absolute_probs_list (   self,
  relative_probs_list 
)

Definition at line 27 of file non_uniform_random_int.py.

def non_uniform_random_int.NonUniformRandomInt.random (   self  ) 

Returns a random integer.

The range and distribution depends on the parameters with which this class has been constructed.

Definition at line 99 of file non_uniform_random_int.py.


Member Data Documentation

Definition at line 24 of file non_uniform_random_int.py.

Definition at line 23 of file non_uniform_random_int.py.


The documentation for this class was generated from the following file:

Generated on Sun May 24 21:48:22 2009 by  doxygen 1.5.8