first commit
This commit is contained in:
68
node_modules/random/dist/generators/function.js
generated
vendored
Normal file
68
node_modules/random/dist/generators/function.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _owLite = require('ow-lite');
|
||||
|
||||
var _owLite2 = _interopRequireDefault(_owLite);
|
||||
|
||||
var _rng = require('../rng');
|
||||
|
||||
var _rng2 = _interopRequireDefault(_rng);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var RNGFunction = function (_RNG) {
|
||||
_inherits(RNGFunction, _RNG);
|
||||
|
||||
function RNGFunction(thunk, opts) {
|
||||
_classCallCheck(this, RNGFunction);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (RNGFunction.__proto__ || Object.getPrototypeOf(RNGFunction)).call(this));
|
||||
|
||||
_this.seed(thunk, opts);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(RNGFunction, [{
|
||||
key: 'next',
|
||||
value: function next() {
|
||||
return this._rng();
|
||||
}
|
||||
}, {
|
||||
key: 'seed',
|
||||
value: function seed(thunk) {
|
||||
(0, _owLite2.default)(thunk, _owLite2.default.function);
|
||||
this._rng = thunk;
|
||||
}
|
||||
}, {
|
||||
key: 'clone',
|
||||
value: function clone() {
|
||||
for (var _len = arguments.length, opts = Array(_len), _key = 0; _key < _len; _key++) {
|
||||
opts[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
return new (Function.prototype.bind.apply(RNGFunction, [null].concat([this._rng], opts)))();
|
||||
}
|
||||
}, {
|
||||
key: 'name',
|
||||
get: function get() {
|
||||
return 'function';
|
||||
}
|
||||
}]);
|
||||
|
||||
return RNGFunction;
|
||||
}(_rng2.default);
|
||||
|
||||
exports.default = RNGFunction;
|
||||
//# sourceMappingURL=function.js.map
|
||||
1
node_modules/random/dist/generators/function.js.map
generated
vendored
Normal file
1
node_modules/random/dist/generators/function.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/generators/function.js"],"names":["RNGFunction","thunk","opts","seed","_rng","ow","function","RNG"],"mappings":";;;;;;;;AAAA;;;;AACA;;;;;;;;;;;;IAEqBA,W;;;AACnB,uBAAaC,KAAb,EAAoBC,IAApB,EAA0B;AAAA;;AAAA;;AAGxB,UAAKC,IAAL,CAAUF,KAAV,EAAiBC,IAAjB;AAHwB;AAIzB;;;;2BAMO;AACN,aAAO,KAAKE,IAAL,EAAP;AACD;;;yBAEKH,K,EAAO;AACX,4BAAGA,KAAH,EAAUI,iBAAGC,QAAb;AACA,WAAKF,IAAL,GAAYH,KAAZ;AACD;;;4BAEe;AAAA,wCAANC,IAAM;AAANA,YAAM;AAAA;;AACd,gDAAWF,WAAX,iBAAuB,KAAKI,IAA5B,GAAqCF,IAArC;AACD;;;wBAfW;AACV,aAAO,UAAP;AACD;;;;EATsCK,a;;kBAApBP,W","file":"function.js","sourcesContent":["import ow from 'ow-lite'\nimport RNG from '../rng'\n\nexport default class RNGFunction extends RNG {\n constructor (thunk, opts) {\n super()\n\n this.seed(thunk, opts)\n }\n\n get name () {\n return 'function'\n }\n\n next () {\n return this._rng()\n }\n\n seed (thunk) {\n ow(thunk, ow.function)\n this._rng = thunk\n }\n\n clone (...opts) {\n return new RNGFunction(this._rng, ...opts)\n }\n}\n"]}
|
||||
56
node_modules/random/dist/generators/math-random.js
generated
vendored
Normal file
56
node_modules/random/dist/generators/math-random.js
generated
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _rng = require('../rng');
|
||||
|
||||
var _rng2 = _interopRequireDefault(_rng);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var RNGMathRandom = function (_RNG) {
|
||||
_inherits(RNGMathRandom, _RNG);
|
||||
|
||||
function RNGMathRandom() {
|
||||
_classCallCheck(this, RNGMathRandom);
|
||||
|
||||
return _possibleConstructorReturn(this, (RNGMathRandom.__proto__ || Object.getPrototypeOf(RNGMathRandom)).apply(this, arguments));
|
||||
}
|
||||
|
||||
_createClass(RNGMathRandom, [{
|
||||
key: 'next',
|
||||
value: function next() {
|
||||
return Math.random();
|
||||
}
|
||||
}, {
|
||||
key: 'seed',
|
||||
value: function seed(_seed, opts) {
|
||||
// intentionally empty
|
||||
}
|
||||
}, {
|
||||
key: 'clone',
|
||||
value: function clone() {
|
||||
return new RNGMathRandom();
|
||||
}
|
||||
}, {
|
||||
key: 'name',
|
||||
get: function get() {
|
||||
return 'default';
|
||||
}
|
||||
}]);
|
||||
|
||||
return RNGMathRandom;
|
||||
}(_rng2.default);
|
||||
|
||||
exports.default = RNGMathRandom;
|
||||
//# sourceMappingURL=math-random.js.map
|
||||
1
node_modules/random/dist/generators/math-random.js.map
generated
vendored
Normal file
1
node_modules/random/dist/generators/math-random.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/generators/math-random.js"],"names":["RNGMathRandom","Math","random","seed","opts","RNG"],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;IAEqBA,a;;;;;;;;;;;2BAKX;AACN,aAAOC,KAAKC,MAAL,EAAP;AACD;;;yBAEKC,K,EAAMC,I,EAAM;AAChB;AACD;;;4BAEQ;AACP,aAAO,IAAIJ,aAAJ,EAAP;AACD;;;wBAdW;AACV,aAAO,SAAP;AACD;;;;EAHwCK,a;;kBAAtBL,a","file":"math-random.js","sourcesContent":["import RNG from '../rng'\n\nexport default class RNGMathRandom extends RNG {\n get name () {\n return 'default'\n }\n\n next () {\n return Math.random()\n }\n\n seed (seed, opts) {\n // intentionally empty\n }\n\n clone () {\n return new RNGMathRandom()\n }\n}\n"]}
|
||||
76
node_modules/random/dist/generators/xor128.js
generated
vendored
Normal file
76
node_modules/random/dist/generators/xor128.js
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
||||
|
||||
var _rng = require('../rng');
|
||||
|
||||
var _rng2 = _interopRequireDefault(_rng);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
||||
|
||||
var RNGXOR128 = function (_RNG) {
|
||||
_inherits(RNGXOR128, _RNG);
|
||||
|
||||
function RNGXOR128(seed, opts) {
|
||||
_classCallCheck(this, RNGXOR128);
|
||||
|
||||
var _this = _possibleConstructorReturn(this, (RNGXOR128.__proto__ || Object.getPrototypeOf(RNGXOR128)).call(this));
|
||||
|
||||
_this.x = 0;
|
||||
_this.y = 0;
|
||||
_this.z = 0;
|
||||
_this.w = 0;
|
||||
|
||||
_this.seed(seed, opts);
|
||||
return _this;
|
||||
}
|
||||
|
||||
_createClass(RNGXOR128, [{
|
||||
key: 'next',
|
||||
value: function next() {
|
||||
var t = this.x ^ this.x << 1;
|
||||
this.x = this.y;
|
||||
this.y = this.z;
|
||||
this.z = this.w;
|
||||
this.w = this.w ^ (this.w >>> 19 ^ t ^ t >>> 8);
|
||||
return (this.w >>> 0) / 0x100000000;
|
||||
}
|
||||
}, {
|
||||
key: 'seed',
|
||||
value: function seed(_seed, opts) {
|
||||
// this._rng = seedrandom(this._seed(seed, opts))
|
||||
|
||||
this.x = this._seed(_seed, opts);
|
||||
|
||||
// discard an initial batch of 64 values
|
||||
for (var i = 0; i < 64; ++i) {
|
||||
this.next();
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: 'clone',
|
||||
value: function clone(seed, opts) {
|
||||
return new RNGXOR128(seed, opts);
|
||||
}
|
||||
}, {
|
||||
key: 'name',
|
||||
get: function get() {
|
||||
return 'xor128';
|
||||
}
|
||||
}]);
|
||||
|
||||
return RNGXOR128;
|
||||
}(_rng2.default);
|
||||
|
||||
exports.default = RNGXOR128;
|
||||
//# sourceMappingURL=xor128.js.map
|
||||
1
node_modules/random/dist/generators/xor128.js.map
generated
vendored
Normal file
1
node_modules/random/dist/generators/xor128.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/generators/xor128.js"],"names":["RNGXOR128","seed","opts","x","y","z","w","t","_seed","i","next","RNG"],"mappings":";;;;;;;;AAAA;;;;;;;;;;;;IAEqBA,S;;;AACnB,qBAAaC,IAAb,EAAmBC,IAAnB,EAAyB;AAAA;;AAAA;;AAGvB,UAAKC,CAAL,GAAS,CAAT;AACA,UAAKC,CAAL,GAAS,CAAT;AACA,UAAKC,CAAL,GAAS,CAAT;AACA,UAAKC,CAAL,GAAS,CAAT;;AAEA,UAAKL,IAAL,CAAUA,IAAV,EAAgBC,IAAhB;AARuB;AASxB;;;;2BAMO;AACN,UAAMK,IAAI,KAAKJ,CAAL,GAAU,KAAKA,CAAL,IAAU,CAA9B;AACA,WAAKA,CAAL,GAAS,KAAKC,CAAd;AACA,WAAKA,CAAL,GAAS,KAAKC,CAAd;AACA,WAAKA,CAAL,GAAS,KAAKC,CAAd;AACA,WAAKA,CAAL,GAAS,KAAKA,CAAL,IAAW,KAAKA,CAAL,KAAW,EAAZ,GAAkBC,CAAlB,GAAuBA,MAAM,CAAvC,CAAT;AACA,aAAO,CAAC,KAAKD,CAAL,KAAW,CAAZ,IAAiB,WAAxB;AACD;;;yBAEKL,K,EAAMC,I,EAAM;AAChB;;AAEA,WAAKC,CAAL,GAAS,KAAKK,KAAL,CAAWP,KAAX,EAAiBC,IAAjB,CAAT;;AAEA;AACA,WAAK,IAAIO,IAAI,CAAb,EAAgBA,IAAI,EAApB,EAAwB,EAAEA,CAA1B,EAA6B;AAC3B,aAAKC,IAAL;AACD;AACF;;;0BAEMT,I,EAAMC,I,EAAM;AACjB,aAAO,IAAIF,SAAJ,CAAcC,IAAd,EAAoBC,IAApB,CAAP;AACD;;;wBA1BW;AACV,aAAO,QAAP;AACD;;;;EAdoCS,a;;kBAAlBX,S","file":"xor128.js","sourcesContent":["import RNG from '../rng'\n\nexport default class RNGXOR128 extends RNG {\n constructor (seed, opts) {\n super()\n\n this.x = 0\n this.y = 0\n this.z = 0\n this.w = 0\n\n this.seed(seed, opts)\n }\n\n get name () {\n return 'xor128'\n }\n\n next () {\n const t = this.x ^ (this.x << 1)\n this.x = this.y\n this.y = this.z\n this.z = this.w\n this.w = this.w ^ ((this.w >>> 19) ^ t ^ (t >>> 8))\n return (this.w >>> 0) / 0x100000000\n }\n\n seed (seed, opts) {\n // this._rng = seedrandom(this._seed(seed, opts))\n\n this.x = this._seed(seed, opts)\n\n // discard an initial batch of 64 values\n for (let i = 0; i < 64; ++i) {\n this.next()\n }\n }\n\n clone (seed, opts) {\n return new RNGXOR128(seed, opts)\n }\n}\n"]}
|
||||
Reference in New Issue
Block a user