Definition
An instance of type random_source is a random source. It allows to generate uniformly distributed random bits, characters, integers, and doubles. It can be in either of two modes: In bit mode it generates a random bit string of some given length p ( 1 < = p < = 31) and in integer mode it generates a random integer in some given range [low..high] ( low < = high < low + 231). The mode can be changed any time, either globally or for a single operation. The output of the random source can be converted to a number of formats (using standard conversions).
#include < LEDA/core/random_source.h >
Creation
random_source | S | creates an instance S of type random_source, puts it into bit mode, and sets the precision to 31. |
random_source | S(int p) | creates an instance S of type random_source, puts it into bit mode, and sets the precision to p ( 1 < = p < = 31). |
random_source | S(int low, int high) | creates an instance S of type random_source, puts it into integer mode, and sets the range to [low..high]. |
Operations