Re: PRNG - currently available solutions aren't addressing many use cases

2015-12-01 Thread David Bruant
Le 01/12/2015 20:20, Michał Wadas a écrit : As we all know, JavaScript as language lacks builtin randomness related utilities. All we have is Math.random() and environment provided RNG - window.crypto in browser and crypto module in NodeJS. Sadly, these APIs have serious disadvantages for

Re: PRNG - currently available solutions aren't addressing many use cases

2015-12-01 Thread joe
If you port the example code from the Wikipedia Mersenne Twister page (and add a float interface), you end up with around 80 lines of code. See here: http://pastebin.com/KiKUcBpH It works extremely well and is quite fast (I've not noticed any performance difference with Math.random, which on V8

Re: PRNG - currently available solutions aren't addressing many use cases

2015-12-01 Thread Ron Waldon
> > -- Forwarded message -- > From: "Michał Wadas" > To: es-discuss@mozilla.org > Cc: > Date: Tue, 1 Dec 2015 20:20:34 +0100 > Subject: PRNG - currently available solutions aren't addressing many use > cases > ... > - not seedable > Chance JS is a fairly

PRNG - currently available solutions aren't addressing many use cases

2015-12-01 Thread Michał Wadas
As we all know, JavaScript as language lacks builtin randomness related utilities. All we have is Math.random() and environment provided RNG - window.crypto in browser and crypto module in NodeJS. Sadly, these APIs have serious disadvantages for many applications: Math.random - implementation

Re: PRNG - currently available solutions aren't addressing many use cases

2015-12-01 Thread Calvin Metcalf
node crypto is asynchronous or sync and it returns a buffer of binary data uint8's are just the default way of that node buffers represent data On Tue, Dec 1, 2015, 2:20 PM Michał Wadas wrote: > As we all know, JavaScript as language lacks builtin randomness related >