Skip to content

Remove the Int as rng functionality #177

@rikhuijzer

Description

@rikhuijzer

Currently, many functions allow users to pass an Intor AbstractRNG as rng argument. In case of an integer, the integer converted to an AbstractRNG via

mk_rng(seed::T) where T <: Integer = Random.MersenneTwister(seed)

There are multiple problems with this:

  1. This is unstable between Julia versions. So, people who write rng=1 would reasonably expect that the results are stable between Julia versions. This is not the case which is bad for reproducibility.
  2. The code is littered with mk_rng calls. Usually mk_rng is called immediately when entering the first public method. However, one exception is the threaded loop in src/classification/main.jl and src/regression/main.jl where the code actually uses the integer to set the seed.
  3. It is non-standard Julia. Packages always just take an AbstractRNG so that the user can decide what type to use.

@ablaom Should we remove the integer functionality in the breaking change which is coming up with #167? Let me know if yes and I'll make a PR.

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