top | item 19084471

(no title)

ansy | 7 years ago

Regarding the first question, fundamentally you can’t “prove” a number is truly random. Even if a number or sequence is completely not random looking (e.g. a valid copy of Windows 98), there is a chance it really is random and coincidental. You could have immediately said that. Did you?

But, given that this was a front end job, a common way to visually test the quality of a pseudo-random number generator is to generate a series of numbers and plot the results with pixels visually[1]. If the PRNG is high quality you’ll get a nice even static field. If there is a bias it will show up as a gradient or pattern in the pixels. I suspect this is actually what the interviewer was after.

[1] http://judeokelly.com/simple-visual-random-number-test/

discuss

order

seattle_spring|7 years ago

That was literally my first guess, and he flatly said it was wrong and not reliable, and to try again. I'm not joking here.