sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 482 forks source link

GL(x, GF(p)).random_element() always same seed (libgap) #27733

Open hellman opened 5 years ago

hellman commented 5 years ago

libgap's randomness is not freshly seeded at the Sage startup. For example, sampling random matrices over GF(p) always produces same results.

$ sage -c 'print GL(4, GF(2)).random_element()'
[0 1 1 1]
[1 1 1 1]
[1 0 1 0]
[1 1 1 0]
$ sage -c 'print GL(4, GF(2)).random_element()'
[0 1 1 1]
[1 1 1 1]
[1 0 1 0]
[1 1 1 0]

Whereas, for example, randint() in Sage is always fresh.

First, this is quite misleading, as it is not even immediately clear that GL uses GAP. Second, it was quite hard to find how to actually reseed that randomness. For example, GAP.set_seed(123) does not help. Instead, libgap.set_seed() does solve the issue.

I guess this relates to the whole libgap's randomness, not only to the GL() groups.

SageMath version 8.7, Release Date: 2019-03-23 │ Using Python 2.7.15.

Component: interfaces

Keywords: randomness

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

embray commented 5 years ago
comment:1

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).

embray commented 5 years ago
comment:2

As the Sage-8.8 release milestone is pending, we should delete the sage-8.8 milestone for tickets that are not actively being worked on or that still require significant work to move forward. If you feel that this ticket should be included in the next Sage release at the soonest please set its milestone to the next release milestone (sage-8.9).