Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think that you only need to store the initial seed (in your case the <code>std::uint_least32_t seed_data[std::mt19937::state_size]</code> array) and the number <code>n</code> of warmup steps you made (eg. using <code>discard(n)</code> as mentioned) for each run/simulation you wish to reproduce.</p> <p>With this information, you can always create a new MT instance, seed it with the previous <code>seed_data</code> and run it for the same <code>n</code> warmup steps. This will generate the same sequence of values onwards since the MT instance will have the same inner state when the warmup ends.</p> <p>When you mention the <code>std::random_device</code> affecting reproducibility, I believe that in your code it is simply being used to generate the seed data. If you were using it as the <em>source</em> of random numbers itself, then you would not be able to have reproducible results. Since you are using it only to generate the seed there shouldn't be any problem. You just <em>can't generate a new seed</em> every time if you want to reproduce values!</p> <p>From the definition of <code>std::random_device</code>: </p> <blockquote> <p>"std::random_device is a uniformly-distributed integer random number generator that produces non-deterministic random numbers."</p> </blockquote> <p>So if it's not deterministic you cannot reproduce the sequence of values produced by it. That being said, use it <em>simply</em> to generate good random seeds only to store them afterwards for the re-runs.</p> <p>Hope this helps</p> <p><strong>EDIT :</strong></p> <p>After discussing with @SteveJessop, we arrived at the conclusion that a simple hash of the dataset (or part of it) would be sufficient to be used as a decent seed for the purpose you need. This allows for a deterministic way of generating the same seeds every time you run your simulations. As mentioned by @Steve, you will have to guarantee that the size of the hash isn't too small compared with <code>std::mt19937::state_size</code>. If it is too small, then you can concatenate the hashes of m, m+M, m+2M, ... until you have enough data, as he suggested.</p> <p>I am posting the updated answer here as the idea of using a hash was mine, but I will upvote @SteveJessop's answer because he contributed to it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload