Hi all,
I have noticed a regression with master in one of my codes, I try to generate a random number like: (Random between: 100000000000 and: 999999999999) asString It is working with 3.2, it fails with a primitiveError in master. Is this something easy to fix? Log: Object: Random new: 625 "<0x403de1d0>" error: primitive operation failed SystemExceptions.PrimitiveFailed(Exception)>>signal (ExcHandling.st:254) SystemExceptions.PrimitiveFailed class(Exception class)>>signal (ExcHandling.st:151) Random(Object)>>primitiveFailed (Object.st:1349) Random>>nextLimit: (Random.st:141) Random>>between:and: (Random.st:124) Random class>>between:and: (Random.st:85) TOPDBPostgres class(TOPDB class)>>generateId (TOPDB.st:62) TOPDBPostgres class(TOPDB class)>>newId (TOPDB.st:103) [] in AddTopUp>>topUp: (AddTopUp.st:36) BlockClosure>>on:do: (BlkClosure.st:193) AddTopUp>>topUp: (AddTopUp.st:39) [] in UndefinedObject>>executeStatements (AddTopUp.st:76) BlockClosure>>ensure: (BlkClosure.st:269) UndefinedObject>>executeStatements (AddTopUp.st:73) _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Tue, Jul 19, 2011 at 13:22, Holger Hans Peter Freyther
<[hidden email]> wrote: > Hi all, > > I have noticed a regression with master in one of my codes, I try to generate > a random number like: > > (Random between: 100000000000 and: 999999999999) asString > > > It is working with 3.2, it fails with a primitiveError in master. Is this > something easy to fix? Yes, it should be enough to add a handler for the failure of #nextLimit:, and combine a few random integers together before scaling the result down to the limit value. Probably the numbers you were getting were not random at all, so it's good that it now fails. :) Paolo _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
On 07/19/2011 03:48 PM, Paolo Bonzini wrote:
> Yes, it should be enough to add a handler for the failure of > #nextLimit:, and combine a few random integers together before scaling > the result down to the limit value. > > Probably the numbers you were getting were not random at all, so it's > good that it now fails. :) One more Mersenne Twister question. So if someone knows a row of 624 random numbers, he knows the internal state of the twister... does it make sense to reseed more often? not a crypto expert holger _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Vue complète
Re : [Help-smalltalk] Limits of Random changed due the mersenne twister De : Mathieu Suen <[hidden email]> Ajouter dans les contacts À : Holger Hans Peter Freyther <[hidden email]> ________________________________ ----- Message d'origine ---- > De : Holger Hans Peter Freyther <[hidden email]> > À : Paolo Bonzini <[hidden email]> > Cc : GNU Smalltalk <[hidden email]> > Envoyé le : Mar 19 juillet 2011, 18h 05min 24s > Objet : Re: [Help-smalltalk] Limits of Random changed due the mersenne twister > > On 07/19/2011 03:48 PM, Paolo Bonzini wrote: > > > Yes, it should be enough to add a handler for the failure of > > #nextLimit:, and combine a few random integers together before scaling > > the result down to the limit value. > > > > Probably the numbers you were getting were not random at all, so it's > > good that it now fails. :) > > One more Mersenne Twister question. So if someone knows a row of 624 random > numbers, he knows the internal state of the twister... does it make sense to > reseed more often? For me you don't know the state of the twister. This is because the operation: y = mt[mt_index]; y ^= (y >> 11); y ^= (y << 7) & 0x9d2c5680; y ^= (y << 15) & 0xefc60000; y ^= (y >> 18); is not reversible. > > not a crypto expert > holger > > _______________________________________________ > help-smalltalk mailing list > [hidden email] > https://lists.gnu.org/mailman/listinfo/help-smalltalk > _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by Holger Freyther
On Tue, Jul 19, 2011 at 18:05, Holger Hans Peter Freyther
<[hidden email]> wrote: > On 07/19/2011 03:48 PM, Paolo Bonzini wrote: > >> Yes, it should be enough to add a handler for the failure of >> #nextLimit:, and combine a few random integers together before scaling >> the result down to the limit value. >> >> Probably the numbers you were getting were not random at all, so it's >> good that it now fails. :) > > One more Mersenne Twister question. So if someone knows a row of 624 random > numbers, he knows the internal state of the twister... does it make sense to > reseed more often? The Mersenne Twister is _absolutely_ not a cryptographic RNG. It only tries hard to produce numbers that look random, it does not prevent you from reproducing or predicting the sequence. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |