简体   繁体   中英

Standard and portable pseudo random number generator based on seed in C++

If i want to start building a PRNG in C++ what are the best bricks for the job?

are there any standardize and portable libraries with a predictable behaviour ( with a seed ) and pseudo randomic?

When you say "portable" I assume you want the same sequence of random numbers given the same seed, no matter which platform they're compiled for. Pseudo-random number generators should provide the same sequence as long as they're based on the same algorithm. I think boost::random is your best bet, it's a good random number generator (better than rand in many cases) with predictable behavior across platforms.

C++11 offers a host of portable random-number generators. This was driven by the folks at Fermilab, who do heavy-duty simulations of subatomic particle interactions, often involving distributing work through a network to many computers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM