Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Tavis Ormandy Newsgroups: comp.programming Subject: Re: Fast randomizer Date: 17 Jan 2021 21:11:45 GMT Lines: 29 Message-ID: References: <4d7dea01-65a4-422e-84ba-ad54b9d09615n@googlegroups.com> X-Trace: individual.net OXPT6z9Bx2mcfUZj8Nh5zgS2cIrQbwSCNDluW+CLAxIhQMQsRR Cancel-Lock: sha1:xLrlb3cj+uk6dIqcq/vfFE1naYI= User-Agent: slrn/pre1.0.4-5 (Linux) Xref: csiph.com comp.programming:11814 On 2021-01-17, H e wrote: > Anybody knows why Javascript Math.random() is so slow? > Am the only one, who thinks, that it can be as fast as a computer screen? > Which implementation? As far as I know, all major implementations use xorshift128+, which is very fast with a very impressive period, 2^128-1. It is just a dozen or so machine instructions on a 64bit machine. You can read about it here: http://vigna.di.unimi.it/ftp/papers/xorshiftplus.pdf > It will be the next a10. Function will remember a2,...,a10. Next > polynom takes as last polynom multiplier new time produced digit. I would suggest implementing your scheme and see if it passes the Diehard test suite. If it does, then see if you can benchmark better than something from the xorshift family with a similar period. (I really think that is a tall order though) https://en.wikipedia.org/wiki/Diehard_tests Tavis. -- _o) $ lynx lock.cmpxchg8b.com /\\ _o) _o) $ finger taviso@sdf.org _\_V _( ) _( ) @taviso