Random Numbers¶
This module provides pseudo-random number generators and random distributions.
- halmd.random.generator(args)¶
Get pseudo-random number generator.
Parameters: - args (table) – keyword arguments
- args.memory (string) – host or gpu (default: compute device)
- args.seed (number) – initial seed value (optional)
Returns: pseudo-random number generator
The first call for each memory argument constructs a singleton instance of the pseudo-random number generator, which is returned in subsequent calls.
If the argument seed is omitted, the initial seed is obtained from the system’s random device, e.g., /dev/urandom on Linux.
- halmd.random.seed(seed)¶
Set (or reset) the seed of the pseudo-random number generator.