# Differences in rand between v0.6 and v0.7

**URL:** <https://discourse.julialang.org/t/differences-in-rand-between-v0-6-and-v0-7/12477>\
**Category:** Internals & Design\
**Created:** [July 19, 2018, 1:07am UTC](https://discourse.julialang.org/t/differences-in-rand-between-v0-6-and-v0-7/12477 "2018-07-19T01:07:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danspielman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danspielman/32/4708_2.png) [@danspielman](https://discourse.julialang.org/u/danspielman)\
**Post date:** [July 19, 2018, 1:07am UTC](https://discourse.julialang.org/t/differences-in-rand-between-v0-6-and-v0-7/12477/1 "2018-07-19T01:07:14Z")

</div>

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
julia> srand(1); rand(1:5,3)
3-element Array{Int64,1}:
 4
 2
 5

```

And, in Julia 0.7:

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

```

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [July 19, 2018, 3:01am UTC](https://discourse.julialang.org/t/differences-in-rand-between-v0-6-and-v0-7/12477/2 "2018-07-19T03:01:58Z")

</div>

The change leading to this was apparently

[https://github.com/JuliaLang/julia/pull/25058](https://github.com/JuliaLang/julia/pull/25058)

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.

---

<div class="post-metadata">

**Author:** ![danspielman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danspielman/32/4708_2.png) [@danspielman](https://discourse.julialang.org/u/danspielman)\
**Post date:** [July 24, 2018, 2:46pm UTC](https://discourse.julialang.org/t/differences-in-rand-between-v0-6-and-v0-7/12477/3 "2018-07-24T14:46:57Z")

</div>

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

> **[GitHub - danspielman/RandomV06.jl: The pseudorandom generators from Julia...](https://github.com/danspielman/RandomV06.jl)**
>
> The pseudorandom generators from Julia 0.6, for use in Julia 0.7 - GitHub - danspielman/RandomV06.jl: The pseudorandom generators from Julia 0.6, for use in Julia 0.7
