Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Chance – Random generator library for JS – my weekend project (chancejs.com)
5 points by vaporstun on June 24, 2013 | hide | past | favorite | 2 comments



are you obtaining entropy through mouse and keyboard interactions?


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.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: