Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Portable random number generator

Reply
Thread Tools

Portable random number generator

 
 
Gus Gassmann
Guest
Posts: n/a
 
      11-15-2010
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
--
comp.lang.c.moderated - moderation address: http://www.velocityreviews.com/forums/(E-Mail Removed) -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
 
Reply With Quote
 
 
 
 
news
Guest
Posts: n/a
 
      11-16-2010
In comp.lang.c++ Gus Gassmann <(E-Mail Removed)> wrote:
> 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.)
--
comp.lang.c.moderated - moderation address: (E-Mail Removed) -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
 
Reply With Quote
 
 
 
 
Eric Sosman
Guest
Posts: n/a
 
      11-17-2010
On 11/15/2010 11:57 AM, Gus Gassmann wrote:
> 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.

--
Eric Sosman
(E-Mail Removed)lid
--
comp.lang.c.moderated - moderation address: (E-Mail Removed) -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Portable random number generator Gus Gassmann C Programming 38 11-23-2010 10:40 PM
Portable random number generator Gus Gassmann C++ 43 11-23-2010 09:51 PM
Portable random number generator Gus Gassmann C++ 2 11-17-2010 07:36 PM
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM



Advertisments