Skip to content

StableRNG is not stable #4

@ablaom

Description

@ablaom

set up

using Random
using StableRNGs

gen = Random.RangeGenerator(1:2)

in julia 1.4.2

rng = StableRNGs.StableRNG(600)
julia> [rand(rng, gen) for i in 1:3]
3-element Array{Int64,1}:
 2
 2
 1

in julia 1.5.0

rng = StableRNGs.StableRNG(600)
julia> [rand(rng, gen) for i in 1:3]
3-element Array{Int64,1}:
 2
 1
 1

This affects rand for Distributions.Categorical and, presumably, many other functions.

version info

Julia Version 1.4.2
Commit 44fa15b150* (2020-05-23 18:35 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_PATH = /Applications/Julia-1.4.app/Contents/Resources/julia/bin/julia
  JULIA_NUM_THREADS = 5
julia> versioninfo()
Julia Version 1.5.0
Commit 96786e22cc (2020-08-01 23:44 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
  JULIA_PATH = /Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia
  JULIA_NUM_THREADS = 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions