1
|
{"version":3,"sources":["../../../src/php/math/rand.js"],"names":["module","exports","rand","min","max","argc","arguments","length","Error","Math","floor","random"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,IAAT,CAAeC,GAAf,EAAoBC,GAApB,EAAyB;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,OAAOC,UAAUC,MAArB;AACA,MAAIF,SAAS,CAAb,EAAgB;AACdF,UAAM,CAAN;AACAC,UAAM,UAAN;AACD,GAHD,MAGO,IAAIC,SAAS,CAAb,EAAgB;AACrB,UAAM,IAAIG,KAAJ,CAAU,uDAAV,CAAN;AACD;AACD,SAAOC,KAAKC,KAAL,CAAWD,KAAKE,MAAL,MAAiBP,MAAMD,GAAN,GAAY,CAA7B,CAAX,IAA8CA,GAArD;AACD,CAlBD","file":"rand.js","sourcesContent":["module.exports = function rand (min, max) {\n // discuss at: http://locutus.io/php/rand/\n // original by: Leslie Hoare\n // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)\n // note 1: See the commented out code below for a version which\n // note 1: will work with our experimental (though probably unnecessary)\n // note 1: srand() function)\n // example 1: rand(1, 1)\n // returns 1: 1\n\n var argc = arguments.length\n if (argc === 0) {\n min = 0\n max = 2147483647\n } else if (argc === 1) {\n throw new Error('Warning: rand() expects exactly 2 parameters, 1 given')\n }\n return Math.floor(Math.random() * (max - min + 1)) + min\n}\n"]}
|