Ticket #2753 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

[with patch, positive review pending] new "randstate" framework for a global Sage random number seed

Reported by: cwitty Owned by: somebody
Priority: major Milestone: sage-3.0
Component: basic arithmetic Keywords:
Cc: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

The attached patch keeps track of the random number seed used on Sage startup, and lets you set a single random number seed, which gets propagated on demand into random number generators for GMP (+ MPFR), Python, NTL, Pari, gp, GAP, and libc (so far).

Also, it moves away from libc's random() in favor of the other generators mentioned above, which are portable across operating systems and architectures; this means that doctest results using random numbers are now reproducible, so I've removed many "# random" from the doctests.

Passes testall on the platforms I have access to (32-bit x86 Linux, 64-bit x86 Linux, and 32-bit x86 OSX).

Attachments

trac2753-randstate.patch Download (183.1 KB) - added by cwitty 5 years ago.
trac2753-hg_scripts-randstate-doctest.patch Download (672 bytes) - added by cwitty 5 years ago.
trac_2753-reject-merges.patch Download (1.7 KB) - added by mabshoff 5 years ago.
manula merges of the rejected hunks against my 3.0.alpha1 merge tree

Change History

Changed 5 years ago by cwitty

Changed 5 years ago by cwitty

comment:1 Changed 5 years ago by rlm

  • Summary changed from [with patch, needs review] new "randstate" framework for a global Sage random number seed to [with patch, positive review] new "randstate" framework for a global Sage random number seed

Applies cleanly to Sage 2.11. I am taking cwitty's word on doctests- I haven't run any of my own. IMO, this greatly improves the robustness of our doctesting infrastructure.

comment:2 Changed 5 years ago by rlm

  • Summary changed from [with patch, positive review] new "randstate" framework for a global Sage random number seed to [with patch, positive review pending] new "randstate" framework for a global Sage random number seed

Patch should be rebased on 3.0.alpha0.

Changed 5 years ago by mabshoff

manula merges of the rejected hunks against my 3.0.alpha1 merge tree

comment:3 Changed 5 years ago by mabshoff

  • Status changed from new to closed
  • Resolution set to fixed

Merged all three patches in Sage 3.0.alpha1

Note: See TracTickets for help on using tickets.