Factors Inhibiting Reproducability Of Simulation Results

Discussion in 'C++' started by Chris Gordon-Smith, Sep 10, 2011.

  1. I just managed to get my artificial chemistry simulation producing the
    same results when I run it twice with the same parameters. Perhaps some
    members of the group will be interested in the two factors that led to
    differing results:

    1) My graphics library (GTKMM2) calling rand() at random times between
    the calls made by my code
    2) My code storing pointers in an std::set, and then iterating over the
    set. The ordering is dependent on the memory locations of the dynamically
    allocated objects to which the pointers point.

    Chris Gordon-Smith
    www.simsoup.info
     
    Chris Gordon-Smith, Sep 10, 2011
    #1
    1. Advertising

  2. Chris Gordon-Smith

    Jorgen Grahn Guest

    On Sat, 2011-09-10, Chris Gordon-Smith wrote:
    > I just managed to get my artificial chemistry simulation producing the
    > same results when I run it twice with the same parameters. Perhaps some
    > members of the group will be interested in the two factors that led to
    > differing results:
    >
    > 1) My graphics library (GTKMM2) calling rand() at random times between
    > the calls made by my code


    Aargh! But in a sense that's just another example of the brokenness
    of rand(). You usually want a PRNG where you keep the state manually.
    I assume the TR1 random number stuff can do that.

    /Jorgen

    --
    // Jorgen Grahn <grahn@ Oo o. . .
    \X/ snipabacken.se> O o .
     
    Jorgen Grahn, Sep 11, 2011
    #2
    1. Advertising

  3. Chris Gordon-Smith

    Miles Bader Guest

    Jorgen Grahn <> writes:
    >> 1) My graphics library (GTKMM2) calling rand() at random times between
    >> the calls made by my code

    >
    > Aargh! But in a sense that's just another example of the brokenness
    > of rand(). You usually want a PRNG where you keep the state manually.
    > I assume the TR1 random number stuff can do that.


    The random state in both TR1 and C++11 is a part of the generator
    object, so ... yeah. [Of course it would be super duper surprising if
    this wasn't true!]

    -Miles

    --
    `There are more things in heaven and earth, Horatio,
    Than are dreamt of in your philosophy.'
     
    Miles Bader, Sep 12, 2011
    #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. Roedy Green

    inhibiting comment reflow

    Roedy Green, Jul 27, 2005, in forum: Java
    Replies:
    11
    Views:
    970
    Roedy Green
    Jul 29, 2005
  2. Replies:
    2
    Views:
    1,404
    Stefan Ram
    Jul 29, 2006
  3. zak

    Top Ten SEO Factors

    zak, Feb 19, 2007, in forum: Java
    Replies:
    1
    Views:
    484
    Andrew Thompson
    Feb 19, 2007
  4. Freyr

    Prime Factors

    Freyr, Feb 28, 2006, in forum: C++
    Replies:
    7
    Views:
    585
    Jerry Coffin
    Feb 28, 2006
  5. srinivas.hyd
    Replies:
    0
    Views:
    593
    srinivas.hyd
    Oct 26, 2007
Loading...

Share This Page