On May 29, 7:29 am, Emil <emi...@gmail.com> wrote:
> On 29 May 2012 15:21, William Stein <wst...@gmail.com> wrote:
>
> > Can you give an example?  E.g., a matrix and a random seed?
>
> Not easily... If it is really necessary I can find the matrix that it
> failed on. Although most of the time it works on this matrix...

That would be of great help. It's usually easier to *set* the seed
than to get it after the fact, since there is a lot of state to
capture. What one would usually do for something like this is:

set_random_seed(0)
while true:
  do_operation_that occasionally_gives_an_error()

i.e., if you can whittle it down to a test where the error occurs
after reasonable time, debugging can already start. For added value,
experiment with setting a different value in set_random_seed so that
the error occurs sooner. In principle one should be able to do

while true:
  C=current_randstate()
  do_operation()

but you'll in fact be getting the same object every time. Only the
seed originally used is accessible. Good random number generators keep
track of a lot more internal state and in sage there are several.

Another alternative would be

for seedvalue in range(10^8):
    print "trying seed: ",seedvalue
    with seed(seedvalue):
        do_random_error_prone_operation()

In all cases, you're hoping that these "seed" routines indeed set all
relevant random generators. Since there are many doctests in sage that
depend on the same, there's a good chance they do.

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to