[Sugar-devel] Random numbers and the Journal

James Zaki james.zaki at gmail.com
Fri Jun 5 10:38:14 EDT 2009


> 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,

Perhaps its not the best practice to rely on a random number generator to
give unique identifiers. Would you not store a number with your program, to
guarantee uniqueness?
Unless I have mistaken the issue.



2009/6/5 Benjamin M. Schwartz <bmschwar at fas.harvard.edu>

> 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?
>
> Thanks,
> Ben
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20090605/528ecca8/attachment.htm 


More information about the Sugar-devel mailing list