On 1/19/11 1:55 PM, Matthew Gwynne wrote:
> Hi,
>
> documentation suggests is used for the Maxima random number
> generator), so it seems it should be easy, however, it's not clear
> exactly how Maxima extracts integers from the state of the Mersenne
> twister, or precisely the implementation of the random_permutation
> function even if the random number generation were the same.
Maxima's implemention is in the file src/rand-mt19937.lisp. From a
quick look at the code, a large integer is obtained by just
concatenating a bunch of 32-bit integers produced by the generator. The
first generated value is in the least significant position.
>
> P.S - As a note, in the coming C++ standard there will be random
> number generators and so on guaranteed by the standard library, and so
> it might make sense if simply using std::random_shuffle with the
> standard number generator yielded the same results as
> random_permutation in Maxima? This would make a description of the
> behaviour in the documentation very simple, as one could just point to
> the more elaborated C++ standard.
That doesn't really help. Maxima is not written in C++.
If the algorithm is described, perhaps we could use the same algorithm.
But if it's different from what maxima already uses, then it might also
break existing code. So, unless maxima's version is broken, I think we
should keep maxima's implementation as is.
Ray