Skip to content

CCRandom initializes its own default state in a non reproducible way #350

@nilsbecker

Description

@nilsbecker

let __default_state = Random.State.make_self_init ()

here an internal __default_state is created with a random seed, which is later used by default in the run functions. this default state is different from the one in the included Stdlib.Random module, namely Random.default, afaict. i came across this because i encountered non-reproducible simulation runs.

i worked around it by always calling run ~st:(Random.get_default_state ()) which copies the default state from Stdlib.Random, which i make sure to initialized in a reproducible way. i think this copying costs performance; a better way would be to create, initialize and later supply my own random state to give to the ~st argument of run.

anyway, i don't quite understand why CCRandom does not reuse the default state in Stdlib.Random? that way, Random.init would make CCRandom.run with default state reproducible, iiuc.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions