Skip to content

Support numpy.random.default_rng #558

@blackberryshortcake

Description

@blackberryshortcake

Description

The readme says:

If numpy is installed, its global random state is reset at the start of every test.

Nowadays, numpy recommends numpy.random.default_rng, which returns a PRNG object and using its methods, e.g.

import numpy as np

# not passing a seed -> implicitly creates a seed from global state
rng = np.random.default_rng()

sample = rng.some_probability_distribution()

They call numpy.random.some_probability_distribution the legacy way.
Randomly supports the legacy way. It reseeds with numpy.random.seed, which doesn't affect dedicated generators (which is what one gets from default_rng).

It'd be great if randomly supported default_rng or if the README was adapted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions