Try to remove non-determinism from random and time in JavaScript