[Sugar-devel] Random numbers and the Journal
Tomeu Vizoso
tomeu at sugarlabs.org
Fri Jun 5 03:57:56 EDT 2009
On Fri, Jun 5, 2009 at 01:54, Benjamin M. Schwartz
<bmschwar at fas.harvard.edu> wrote:
> I'm using python's random.getrandbits() to generate unique identifiers in
> my program. However, I've discovered that when I start it from the
> Journal, I get errors, which I can trace to the random number generator
> producing the same sequence of random numbers that was generated when I
> started it the first time. It is as if the random seed is being reset
> every time I launch from the Journal.
>
> Does anyone know what's going on here?
No idea without more details. AFAICS, Sugar is not explicitly seeding
the rng, that is done implicitly from python.
Launching an activity from the journal is not that different, for
activities not using sugar-toolkit it just boils down to an arg being
added to the command line of the activity. For the other activities,
some code will be executed about initializing the DS object and asking
the concrete activity to do something with the journal entry.
If you haven't done it yet, I would recommend doing the simplest
activity you can think of, and try to reproduce this issue, to rule
out a problem in your activity.
Regards,
Tomeu
> Thanks,
> Ben
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
More information about the Sugar-devel
mailing list