Am Mon, 11 Jun 2012 13:09:26 -0500
schrieb Andrei Alexandrescu <seewebsiteforem...@erdani.org>:

> On 6/11/12 12:32 PM, Joseph Rushton Wakeling wrote:
> > On 11/06/12 18:15, Johannes Pfau wrote:
> >> Could someone who's familiar with RNGs answer this question? This
> >> seems to be important for st.uuid, we should get this right.
> >
> > In the Boost C++ implementation it certainly accepts a range as
> > input:
> >
> > template<class It>
> > void seed(It& first, It last)
> > {
> > int j;
> > for(j = 0; j < n && first != last; ++j, ++first)
> > x[j] = *first;
> > i = n;
> > if(first == last && j < n)
> > throw std::invalid_argument("mersenne_twister::seed");
> > }
> >
> > Some information on the seeding issue can be found here:
> > http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html
> 
> We should have the same in std.random. Could anyone please initiate a 
> pull request?
> 
> Thanks,
> 
> Andrei

Here's a first try:
https://gist.github.com/2916360

Three questions:

* As seed is a normal function right now, I can't overload it with a
  template. Is it safe to make the original seed a template as well, so
  seedRange could be named seed, or would that break the API?

* How should the seed array/range be generated? By repeatedly calling
  unpredictableSeed?

* Is there a Range which repeatedly calls a function? Similar to
  repeat, but not repeating a value.

Reply via email to