Freeware JavaScript Editor Perl Tutorials

↑

Main Page |

## Recipe 2.8 Making Numbers Even More Random## 2.8.1 ProblemYou want to generate numbers that are more random than Perl's random numbers. Limitations of your C library's random number generator seeds can sometimes cause problems. The sequence of pseudo-random numbers may repeat too soon for some applications. ## 2.8.2 SolutionUse a different random number generator, such as those provided by the Math::Random and Math::TrulyRandom modules from CPAN: use Math::TrulyRandom; $random = truly_random_value( ); use Math::Random; $random = random_uniform( ); ## 2.8.3 DiscussionThe Perl build process tries to find the best C-library routine to
use for generating pseudo-random numbers, looking at
rand(3), random(3), and
drand48(3). (This can be changed manually at
build time, however.) The standard library functions are getting
pretty good, but some ancient implementations of the
The Math::TrulyRandom module uses inadequacies of your system's timers to generate the random numbers. This takes a while, so it isn't useful for generating a lot of random numbers. The Math::Random module uses the ## 2.8.4 See AlsoThe |

Main Page |

↓ Конструкторов сайтов konstruktorysajtov.com.

JavaScript Verifier Perl Tutorials

©