On Oct 10, 5:45 pm, [EMAIL PROTECTED] wrote:
> Ryan Hinton wrote:
> > Jason,
>
> > I saw a suggestion recently on the sage list to set the random seed at
> > the beginning of each doctest so previously "random" outputs could be
> > tested.  I'm writing some 'pick a random member from this (very large)
> > set' routines, so I could use this functionality.  Is it in yet?  How
> > can I set the random seed (inside my doctest)?
>
> > Thanks!
>
> I think Carl Witty wrote this functionality (I've CCd him).  I think it
> is in now, but he knows the details of how to use it.

Quick summary:

The random seed is automatically set at the beginning of each
docstring.  If you're using the standard Sage random number routines
(like ZZ.random_element(), or the combinatorics random elements,
etc.), then you shouldn't have to do anything to make your doctest
repeatable.

If you do want to set a random seed inside your docstring (or at the
Sage command line), use

sage: set_random_seed(0)

(or pick another number instead of the 0).

For more details, there's about 400 lines of documentation at the top
of sage/misc/randstate.pyx; I don't want to repeat it all here :)

Carl
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to