summaryrefslogtreecommitdiff
path: root/src/lmathlib.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-08-18 13:49:16 +1000
committerdaurnimator <quae@daurnimator.com>2017-08-18 13:52:20 +1000
commit36f446c3d43a90063962f8af790e7b58b08765f5 (patch)
tree7ffa6e9785440fa4b2c54b03cd97f8de80f7e4ae /src/lmathlib.js
parent389630abe2f44e122d29af7159dd1a0d5c585d15 (diff)
downloadfengari-36f446c3d43a90063962f8af790e7b58b08765f5.tar.gz
fengari-36f446c3d43a90063962f8af790e7b58b08765f5.tar.bz2
fengari-36f446c3d43a90063962f8af790e7b58b08765f5.zip
Remove math.randomseed implementation
See #78
Diffstat (limited to 'src/lmathlib.js')
-rw-r--r--src/lmathlib.js20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/lmathlib.js b/src/lmathlib.js
index 4a62d52..16e2ad3 100644
--- a/src/lmathlib.js
+++ b/src/lmathlib.js
@@ -1,22 +1,13 @@
"use strict";
-const seedrandom = require('seedrandom');
-
-const lua = require('./lua.js');
-const lauxlib = require('./lauxlib.js');
-const llimit = require('./llimit.js');
-const luaconf = require('./luaconf.js');
-
-var RNG = seedrandom();
-
-const math_randomseed = function(L) {
- RNG = seedrandom(Math.abs(lauxlib.luaL_checknumber(L, 1)));
- return 0;
-};
+const lua = require('./lua.js');
+const lauxlib = require('./lauxlib.js');
+const llimit = require('./llimit.js');
+const luaconf = require('./luaconf.js');
const math_random = function(L) {
let low, up;
- let r = RNG();
+ let r = Math.random();
switch (lua.lua_gettop(L)) { /* check number of arguments */
case 0:
lua.lua_pushnumber(L, r); /* Number between 0 and 1 */
@@ -252,7 +243,6 @@ const mathlib = {
"modf": math_modf,
"rad": math_rad,
"random": math_random,
- "randomseed": math_randomseed,
"sin": math_sin,
"sqrt": math_sqrt,
"tan": math_tan,