Skip to content

py3: problems with tests that use random_element #24508

@embray

Description

@embray

Lots and lots of tests fail on Python 3 due to the use of random_elements in tests.

The problem, I've found, is not to do with seeding the RNG. Python's random produces the same sequence with the same seed on Python 2 and 3. However, there is a slight difference in the implementation of random.randint, such that it does produce different values, annoyingly.

I'm not sure how we want to deal with this. In Sage there's a sage.misc.prandom that for some reason provides wrappers around functions from Python's random module. Perhaps one thing we could do is ensure that sage.misc.prandom is always used, and modify its wrapper to randint (actually randrange, which randint is implemented on top of), to provide consistent results.

Component: python3

Author: Erik Bray

Branch/Commit: 4ac044a

Reviewer: Jeroen Demeyer

Issue created by migration from https://trac.sagemath.org/ticket/24508

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions