Settings

Theme

Show HN: Chance – Random generator library for JS – my weekend project

chancejs.com

5 points by vaporstun 13 years ago · 2 comments

Reader

niknak24 13 years ago

are you obtaining entropy through mouse and keyboard interactions?

  • vaporstunOP 13 years ago

    There is no entropy generation here, it is based on the Mersenne Twister, so it is pseudo-random only at this point. If none is provided, the seed is just the current timestamp.

    I discuss this a bit more in the docs: http://chancejs.com/#todo

    This is good for repeatability, bad if "true random" is needed.

    Problem is, this is very tricky. I'd like to add it at some point, but finding a way to add entropy that works both in the browser and in Node would be quite difficult. For example, I could use mouse/keyboard in browser, but not in some server app running on node.

    I could use an external service (like random.org) as the underlying random (I built it in such a way that this was easily swappable/replaceable), but then I'm adding network latency. I show an example like this in the docs: http://chancejs.com/#browser

    So for now I'm punting on it, with a plan to revisit later.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection