Commit Graph

5 Commits

Author SHA1 Message Date
Emily Stark
e544a8e03a Increase length of security-critical random tokens. Add Random.secret. 2014-04-17 16:12:16 -07:00
Justin SB
a6e9ae392b Rename create -> createWithSeeds, require parameters 2014-03-20 17:05:04 -07:00
Justin Santa Barbara
64f0c73b6b Refactor Random.create() to be consistent with the global Random creation 2014-03-20 17:05:04 -07:00
Emily Stark
2413a8d3ed Use cryptographic PRNGs when available.
This means node's crypto.randomBytes on the server, and
window.crypto.getRandomValues on the client. If node's crypto.randomBytes throws
an exception, we fall back to crypto.pseudoRandomBytes. If
window.crypto.getRandomValues isn't supported by the browser, we fall back to
the alea generator that we had been using previously.
2013-09-25 15:53:04 -07:00
Andrew Wilcox
1ad813951b Allow new Random instances to be constructed with specified seed.
For repeatable unit test failures with "random" data it's useful to be
able to create deterministic random number sequences.

Introduce `Random.create(seed...)` which returns a object with the
`Random` API (`id()`, `choice()`, etc.) initialized with the passed
seed(s).
2013-05-22 21:34:39 -07:00