NAME
Config::Generator::Random - Config::Generator pseudo-random support
DESCRIPTION
This module eases the generation of pseudo-random "data". The goal is to be able to generate random but reproducible data, for instance to smear times in crontabs.
The initial seed usually comes from a file named random.bin
that can be created with something like:
$ dd if=/dev/urandom of=random.bin bs=512 count=1
Then, modules can use the random_seed() function to make sure that what they generate is different from what other modules generate.
Finally, modules can use the random_integer() function to generate reproducible pseudo-random integers.
FUNCTIONS
This module provides the following functions (none of them being exported by default):
- random_init([PATH])
-
initialize the pseudo-random generator with the content of the given file or by using a file named
random.bin
if it can be located via the usual include path (the@IncPath
variable of the Config::Generator module) - random_integer(N, DATA...)
-
return a pseudo-random integer between 0 and N-1, using the given DATA for additional seeding
- random_seed(DATA)
-
add the given DATA to the initial seed used by the pseudo-random generator
AUTHOR
Lionel Cons http://cern.ch/lionel.cons
Copyright (C) CERN 2013-2016