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AAM,EAAQ,GACtB,EAAI,EAAK,GACT,EAAI,EAAK,GACf,EAAK,GAAS,EACd,EAAK,GAAS,CAChB,CACA,OAAO,CACT,EAUO,IACT,CAEA,OAAO,QAAU","file":"/npm/unusual@0.0.3/unusual.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/unusual@0.0.3/unusual.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","'use strict';\n\nvar katsuCurry = require('katsu-curry');\n\n// This is a nearly 1:1 port of fast-twister\n// A few small modifications were made, in order to:\n// 1. add conditional logging\n// 2. match existing lint / best-practices\n// 3. deal with ESM modules\n// The original license of fast-twister: https://gitlab.com/rockerest/fast-mersenne-twister/-/blob/master/LICENSE\n// and it has been placed below for consistency\n/*\n-------------------------\nThe below license is duplicated per the terms of the original software.\n\nPer http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/elicense.html, the Mersenne Twister has no usage restrictions.\n-------------------------\n\nCoded by Takuji Nishimura and Makoto Matsumoto.\n\nBefore using, initialize the state by using init_genrand(seed)\nor init_by_array(init_key, key_length).\n\nCopyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions\nare met:\n\n\t1. Redistributions of source code must retain the above copyright\n\tnotice, this list of conditions and the following disclaimer.\n\n\t2. Redistributions in binary form must reproduce the above copyright\n\tnotice, this list of conditions and the following disclaimer in the\n\tdocumentation and/or other materials provided with the distribution.\n\n\t3. The names of its contributors may not be used to endorse or promote\n\tproducts derived from this software without specific prior written\n\tpermission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR\nCONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\nEXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\nPROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\nPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\nNEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\nAny feedback is very welcome.\nhttp://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html\nemail: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)\n\n-------------------------\n\nAdditionally, the implementation in this repository (mersenne.js), is a VERY\nheavily modified version of Stephan Brumme's version of the Mersenne Twister,\nfound here: https://create.stephan-brumme.com/mersenne-twister/\n\nThe license for that implementation is below.\n\n-------------------------\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n   claim that you wrote the original software. If you use this software\n   in a product, an acknowledgment in the product documentation would be\n   appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be\n   misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n\n-------------------------\n\nIt has already been stated, but bears repeating:\n\nWhile this implementation is based on Stephan Brumme's code, it has been\n    very heavily modified - primarily for syntax, but also some small algorithm changes\n    to make it agree with the original C version from Matsumoto & Nishimura\n\n*/\n\nconst N = 624;\nconst N_MINUS_1 = 623;\nconst M = 397;\nconst M_MINUS_1 = 396;\nconst DIFF = N - M;\nconst MATRIX_A = 0x9908b0df;\nconst UPPER_MASK = 0x80000000;\nconst LOWER_MASK = 0x7fffffff;\n\nfunction twist(state) {\n  let bits;\n\n  for (let i = 0; i < DIFF; i++) {\n    bits = (state[i] & UPPER_MASK) | (state[i + 1] & LOWER_MASK);\n    // console.log(`${i}: ${bits} = (${state[i]} & ${UPPER_MASK}) | (${state[i + 1]} & ${LOWER_MASK})`)\n    state[i] = state[i + M] ^ (bits >>> 1) ^ ((bits & 1) * MATRIX_A);\n    // console.log(`${i}: ${state[i]} = ${state[i + M]} ^ ${(bits >>> 1)} ^ ${((bits & 1) * MATRIX_A)})`)\n  }\n  for (let i = DIFF; i < N_MINUS_1; i++) {\n    bits = (state[i] & UPPER_MASK) | (state[i + 1] & LOWER_MASK);\n    state[i] = state[i - DIFF] ^ (bits >>> 1) ^ ((bits & 1) * MATRIX_A);\n  }\n\n  bits = (state[N_MINUS_1] & UPPER_MASK) | (state[0] & LOWER_MASK);\n  state[N_MINUS_1] = state[M_MINUS_1] ^ (bits >>> 1) ^ ((bits & 1) * MATRIX_A);\n\n  return state\n}\n\nfunction initializeWithArray(seedArray) {\n  const state = initializeWithNumber(19650218);\n  const len = seedArray.length;\n\n  let i = 1;\n  let j = 0;\n  let k = N > len ? N : len;\n\n  for (; k; k--) {\n    const s = state[i - 1] ^ (state[i - 1] >>> 30);\n    state[i] =\n      (state[i] ^\n        (((((s & 0xffff0000) >>> 16) * 1664525) << 16) +\n          (s & 0x0000ffff) * 1664525)) +\n      seedArray[j] +\n      j;\n    i++;\n    j++;\n    if (i >= N) {\n      state[0] = state[N_MINUS_1];\n      i = 1;\n    }\n    if (j >= len) {\n      j = 0;\n    }\n  }\n  for (k = N_MINUS_1; k; k--) {\n    const s = state[i - 1] ^ (state[i - 1] >>> 30);\n\n    state[i] =\n      (state[i] ^\n        (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) +\n          (s & 0x0000ffff) * 1566083941)) -\n      i;\n    i++;\n    if (i >= N) {\n      state[0] = state[N_MINUS_1];\n      i = 1;\n    }\n  }\n\n  state[0] = UPPER_MASK;\n\n  return state\n}\n\nfunction initializeWithNumber(seed) {\n  const state = new Array(N);\n\n  // fill initial state\n  state[0] = seed;\n  for (let i = 1; i < N; i++) {\n    const u = state[i - 1];\n    const s = u ^ (u >>> 30);\n    const t = s & 0xffff0000;\n    const t16 = t >>> 16;\n    const bigT16 = t16 * 1812433253;\n    const bigT = bigT16 << 16;\n    const hexS = s & 0x0000ffff;\n    const nu = bigT + hexS * 1812433253 + i;\n    state[i] = nu;\n  }\n  return state\n}\n\nfunction initialize(seed = Date.now()) {\n  const state = Array.isArray(seed)\n    ? initializeWithArray(seed)\n    : initializeWithNumber(seed);\n  return twist(state)\n}\nfunction MersenneTwister(seed) {\n  let state = initialize(seed);\n  let next = 0;\n  const randomInt32 = () => {\n    let x;\n    if (next >= N) {\n      state = twist(state);\n      next = 0;\n    }\n\n    x = state[next++];\n\n    x ^= x >>> 11;\n    x ^= (x << 7) & 0x9d2c5680;\n    x ^= (x << 15) & 0xefc60000;\n    x ^= x >>> 18;\n\n    return x >>> 0\n  };\n  const api = {\n    // [0,0xffffffff]\n    randomNumber: () => randomInt32(),\n    // [0,0x7fffffff]\n    random31Bit: () => randomInt32() >>> 1,\n    // [0,1]\n    randomInclusive: () => randomInt32() * (1.0 / 4294967295.0),\n    // [0,1)\n    random: () => randomInt32() * (1.0 / 4294967296.0),\n    // (0,1)\n    randomExclusive: () => (randomInt32() + 0.5) * (1.0 / 4294967296.0),\n    // [0,1), 53-bit resolution\n    random53Bit: () => {\n      const a = randomInt32() >>> 5;\n      const b = randomInt32() >>> 6;\n      return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0)\n    },\n  };\n\n  return api\n}\n\nconst MAX_INT = 9007199254740992;\nconst CONSTANTS = {\n  MAX_INT,\n  MIN_INT: MAX_INT * -1,\n};\n\nconst ERRORS = {\n  TOO_BIG: 'Number exceeds acceptable JavaScript integer size!',\n  TOO_SMALL: 'Number is below acceptable JavaScript integer size!',\n  MIN_UNDER_MAX: 'Minimum must be smaller than maximum!',\n};\n\nfunction throwOnInvalidInteger(x) {\n  const minTest = testValidInteger(x);\n  if (minTest) {\n    throw new RangeError(ERRORS[minTest])\n  }\n}\n\nfunction testValidInteger(x) {\n  if (x > CONSTANTS.MAX_INT) {\n    return 'TOO_BIG'\n  }\n  if (x < CONSTANTS.MIN_INT) {\n    return 'TOO_SMALL'\n  }\n  return false\n}\n\nfunction Unusual(seed) {\n  if (!(this instanceof Unusual)) {\n    // eslint-disable-next-line no-unused-vars\n    return seed ? new Unusual(seed) : new Unusual()\n  }\n  this.seed = Array.isArray(seed) || typeof seed === 'number' ? seed : 0;\n  if (typeof seed === 'string') {\n    let seedling = 0;\n    let hash = 0;\n    seed.split('').forEach((c, i) => {\n      hash = seed.charCodeAt(i) + (hash << 6) + (hash << 16) - hash;\n      seedling += hash;\n    });\n    this.seed += seedling;\n  }\n  const twister = new MersenneTwister(this.seed);\n  const random = twister.random;\n\n  function integer({ min, max }) {\n    const test = [min, max];\n    test.map(throwOnInvalidInteger);\n    if (min > max) {\n      throw new RangeError(ERRORS.MIN_UNDER_MAX)\n    }\n    return Math.floor(random() * (max - min + 1) + min)\n  }\n  const int = katsuCurry.curry(function __int(min, max) {\n    return integer({ min, max })\n  });\n  function pick(list) {\n    const max = list.length - 1;\n    const index = int(0, max);\n    return list[index]\n  }\n\n  function pickKey(obj) {\n    const keys = Object.keys(obj);\n    return pick(keys)\n  }\n  function pickValue(obj) {\n    const key = pickKey(obj);\n    return obj[key]\n  }\n  function floor(x) {\n    return Math.floor(random() * x)\n  }\n  function floorMin(min, x) {\n    const output = floor(x) + min;\n    return output\n  }\n  function shuffle(list) {\n    const copy = [].concat(list);\n    let start = copy.length;\n    while (start-- > 0) {\n      const index = floor(start + 1);\n      const a = copy[index];\n      const b = copy[start];\n      copy[index] = b;\n      copy[start] = a;\n    }\n    return copy\n  }\n  this.random = random;\n  this.integer = integer;\n  this.int = int;\n  this.pick = pick;\n  this.pickKey = pickKey;\n  this.pickValue = pickValue;\n  this.floor = floor;\n  this.floorMin = katsuCurry.curry(floorMin);\n  this.shuffle = shuffle;\n  return this\n}\n\nmodule.exports = Unusual;\n"]}