Instances of CGAL_Random can be seen as input streams. Different streams are independent of each other, i.e. the sequence of numbers from one stream does not depend upon how many numbers were extracted from the other streams.
It can be very useful, e.g. for debugging, to reproduce a sequence of random numbers. This can be done by either initializing deterministically or using the seed functions as described below.
#include <CGAL/Random.h>
|
| This global variable is used as the default random numbers generator. |
| |
Seed type.
|
| |
introduces a variable random of type CGAL_Random.
| |
| |
introduces a variable random of type CGAL_Random and
initializes its internal seed with seed.
| |
| |
introduces a variable random of type CGAL_Random and
initializes its internal seed using init. Equal values for
init result in equal sequences of random numbers.
|
|
| returns a random bool. | ||
|
| |||
returns a random int from the interval lower,upper. | ||||
|
| |||
returns a random double from lower,upper. | ||||
|
| |||
returns random.get_int( 0, upper). |
|
| |
saves the current internal seed in seed. | ||
|
| |
restores the internal seed from seed. |
|
| returns true, iff random and random2 have equal internal seeds. |