Differences in rand between v0.6 and v0.7


#1

There seem to be some differences between what rand produces in Julia 0.6 and 0.7.
Is there any standard way to obtain the behavior of rand from Julia 0.6 in 0.7 ?

For example, in Julia 0.6.4:

julia> srand(1); rand(1:5,3)
3-element Array{Int64,1}:
 4
 2
 5

And, in Julia 0.7:

julia> srand(1); rand(1:5,3)
3-element Array{Int64,1}:
 3
 2
 3

#2

The change leading to this was apparently

where there are some (speculative?) suggestions for duplicating old behavior, and a reference to @simonbyrne stating that sample reproducability across Julia versions is not guaranteed.

Note that the default Mersenne twister implementation has a Float64 library API, and Float64 samples do appear consistent between 0.6 and 0.7 (AFAICT). The means of converting these to integers is changed by the above PR.


#3

Here’s a package that I wrote to solve this, at least for the cases I need.