i need a random generator. it should be able to generate serial #s along side.
any website in mind?
please help.:yawn:

Recommended Answers

All 2 Replies

Please don't use rand() for anything but test applications.
This is especially true if you have strong consequences for short sequences of very high/very low random numbers. Additionally, if you need randomness immediately, for the first few numbers, then don't use rand(). [Especially since most people random number seeds are way to short which accentuates this problem].

If you need a random number generator try Merseen Twister.
http://www-personal.umich.edu/~wagnerr/MersenneTwister.html This is a c++ versions.

The advantages are that is passes TestU01-Crush and that is not something many random number generators do. Additionally it is only about a little slower than standard rand().

Two things to consider, there is a 32bit and a 64 bit version. (you can use the 32 bit on a 64 bit and visa-versa but you loose speed or stride).

If you need a faster random number generator, there is a fast SMTF algorithm but it is 128 bit algorithm. That is fine for modern chips (>about 2005) BUT not everything. i.e. So be careful when sending to a hetrogenious cluster.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.