Made the state variable local
This commit is contained in:
parent
723b8b64c9
commit
4999467b29
1 changed files with 4 additions and 4 deletions
|
@ -5,14 +5,14 @@
|
|||
* 2016 arookas
|
||||
\* ================================================= */
|
||||
|
||||
var __RAND_NEXT;
|
||||
var local next;
|
||||
|
||||
function srand(seed) {
|
||||
__RAND_NEXT = seed;
|
||||
next = seed;
|
||||
}
|
||||
|
||||
function rand() {
|
||||
// this is exactly the formula used in MSL (and, thus, SMS itself)
|
||||
__RAND_NEXT = (__RAND_NEXT * 1103515245) + 12345;
|
||||
return (__RAND_NEXT >> 16) & 0x7FFF;
|
||||
next = (next * 1103515245) + 12345;
|
||||
return (next >> 16) & 0x7FFF;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue