Boost logo

Boost Users :

Subject: Re: [Boost-users] [random] Problems generating pseudorandom 64-bit ints across multiple computers
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-02-27 16:16:59


AMDG

James Madison wrote:
> Thanks for the reply, I tried implementing your suggestion of using a
> pair of iterators, but I think that I might be misinterpreting the
> source, and that it is still only using a 32-bit seed.
>
> From looking at the source, the seed appears to be stored as the
> variable "i", which is of type int. The seed method using two
> iterators does a ton of mangling over the range, and assigned i to the
> result.

I don't understand. I see this:

  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");
  }

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net