Portable random number generator

G

Gus Gassmann

I presume this should be a FAQ, but I have not found much that is of
use...

For a project I am involved in I need to do some random testing. I am
looking for a random number generator with the following principles:

1. Portable. The project runs on several platforms, and I would like
to be able to support the testing on all of them. In particular,
starting from a given seed the sequence must be the same on 32-bit
and 64-bit machines.
2. Starting points must be random. I want to use an initial seed that
depends in some way on the clock.
3. Reproducibility. If I detect an error, I must be able to capture
the system state so I can reproduce the problem.
4. Simplicity. I am not looking for a fancy Mersenne twister; the
entire state of the RNG should be describable in a single seed.
Statistical properties are secondary.

I am working in C++, but a C solution would be equally useful. Any
thoughts?

Thanks

gus
 
N

news

In comp.lang.c++ Gus Gassmann said:
I presume this should be a FAQ, but I have not found much that is of
use...

For a project I am involved in I need to do some random testing. I am
looking for a random number generator with the following principles:

1. Portable. The project runs on several platforms, and I would like
to be able to support the testing on all of them. In particular,
starting from a given seed the sequence must be the same on 32-bit
and 64-bit machines.
2. Starting points must be random. I want to use an initial seed that
depends in some way on the clock.
3. Reproducibility. If I detect an error, I must be able to capture
the system state so I can reproduce the problem.
4. Simplicity. I am not looking for a fancy Mersenne twister; the
entire state of the RNG should be describable in a single seed.
Statistical properties are secondary.

I am working in C++, but a C solution would be equally useful. Any
thoughts?

You know, there is this thing called Google...

(And finding such RNGs isn't specially hard with it.)
 
E

Eric Sosman

I presume this should be a FAQ, but I have not found much that is of
use...

For a project I am involved in I need to do some random testing. I am
looking for a random number generator with the following principles:
[...]
I am working in C++, but a C solution would be equally useful. Any
thoughts?

My first thought is that you haven't explained why you weren't
satisfied with the answers you got the first time you asked this
exact same question. My second thought is to refer you to those
same answers. My third thought is that I'd really be unhappy if
the same question from the same questioner popped up a third time.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top