I'm having problems with random number generation and product refreshes.
To illustrate the problem, consider the following product code:
"initialize an instance"
self.id = id
self.__random = Random(time.time())
returns next random number.
ok, this works but whenever the product is refreshed or the zope server
restarts, the generator will start to generate the same sequence of
numbers, which is not what I want.
I'm having trouble understanding what is happening:
since the object gets pumped up every request it would make sense
that you get the same random number if you lose some state from the
internal random generator. But this isn't happening. You apparantly only
lose state when the product is refreshed or when the zope server
restarts. Could this be a cache effect ?
(I could, as a last resort seed the generator with the current time
every request, but then, I lose all guarantees about the period for the
random number generation)
any input appreciated.
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -
- Re: [Zope-dev] product refresh and random number gener... Romain Slootmaekers
- Re: [Zope-dev] product refresh and random number ... Toby Dickenson