[pygtk] random numbers and gtk

Stephen Langer stephen.langer at nist.gov
Tue Oct 11 23:14:24 WST 2011


On Oct 11, 2011, at 10:11 AM, Stephen Langer wrote:

> Hi --
> 
> Does gtk or pygtk use random numbers?  I'm writing a program that uses random numbers (from the stdlib random() function).  The program's test suite needs to have reproducible numbers, so one of the first things it does is to seed the random number generator with a fixed value.  However,
> if the random number generator is seeded before the pygtk gui is built, the random sequence begins at a different point than if the random number generator is seeded after the gui is built.  This indicates that building the gui consumes some random numbers. 
> 
> Where (and why) does pygtk/gtk/cairo/pango use random numbers?  The gui doesn't use them explicitly.  If I knew which pygtk calls might use them, then I could try to avoid those calls in the test suite, or at least ensure that they occur before the random number generator is seeded.
> 
> Thanks,
>    Steve

I forgot to mention that I'm using pygtk 2.22 on OS X (MacPorts), but the problem appears on other versions as well.

 -- Steve


--
-- stephen.langer at nist.gov                    Tel: (301) 975-5423 --
-- http://math.nist.gov/~SLanger/             Fax: (301) 975-3553 --
-- NIST, 100 Bureau Drive, Stop 8910, Gaithersburg, Md 20899-8910 --

-- "I don't think this will work.  That's why it's science."      --
--                     Naomi Langer (age 6),  17 Feb 2003         --








More information about the pygtk mailing list