kripken/emscripten — pull request #1855 by coolwanglu (2013-11-25 11:04:48+00:00)
Title: srand() and simple rand() supporting seed

This is a simple LCG which used to be popular in implementations of c libraries. It might be as good as Math.random() in terms of randomness, but it support specifying seed, which is more important sometimes.

I have also considered porting other implementations (e.g. `random()`), but usually they involves lots of 32-bit integer multiplications, or even 64-bit.

I wonder if the libraries written in JS can be split into submodules, such that each of them may be written in JS, or compile from C/C++ — kind of linking — there seems to be such mechanisms for many large projects (e.g. poppler) in `tests/`, but not for standard libraries. At least I feel that it might be better to compile a C version of `random()` instead of re-implement it in JavaScript, especially as it's a independent small library.

Are there any side effects in this way?