Portable random number generator

Discussion in 'C Programming' started by Gus Gassmann, Nov 15, 2010.

  1. Gus Gassmann

    Gus Gassmann Guest

    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: -- 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.
     
    Gus Gassmann, Nov 15, 2010
    #1
    1. Advertising

  2. Gus Gassmann

    news Guest

    In comp.lang.c++ 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:
    >
    > 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: -- 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.
     
    news, Nov 16, 2010
    #2
    1. Advertising

  3. Gus Gassmann

    Eric Sosman Guest

    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
    lid
    --
    comp.lang.c.moderated - moderation address: -- 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.
     
    Eric Sosman, Nov 17, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. globalrev
    Replies:
    4
    Views:
    773
    Gabriel Genellina
    Apr 20, 2008
  2. Gus Gassmann

    Portable random number generator

    Gus Gassmann, Nov 10, 2010, in forum: C Programming
    Replies:
    38
    Views:
    1,172
    Nobody
    Nov 23, 2010
  3. Gus Gassmann

    Portable random number generator

    Gus Gassmann, Nov 10, 2010, in forum: C++
    Replies:
    43
    Views:
    993
    Malcolm McLean
    Nov 23, 2010
  4. Gus Gassmann

    Portable random number generator

    Gus Gassmann, Nov 15, 2010, in forum: C++
    Replies:
    2
    Views:
    303
    Eric Sosman
    Nov 17, 2010
  5. VK
    Replies:
    15
    Views:
    1,177
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page