From 36f446c3d43a90063962f8af790e7b58b08765f5 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Fri, 18 Aug 2017 13:49:16 +1000 Subject: Remove math.randomseed implementation See #78 --- src/lmathlib.js | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/lmathlib.js') 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, -- cgit v1.2.3-54-g00ecf