消除我特牛
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 lines
173 KiB

4 weeks ago
!function(){function a(e){if(!(this instanceof a))return e||(e=null),null===e?new a:new a(e);if("function"==typeof e)return this.random=e,this;arguments.length&&(this.seed=0);for(var n=0;n<arguments.length;n++){var i=0;if("[object String]"===Object.prototype.toString.call(arguments[n]))for(var r=0;r<arguments[n].length;r++){for(var o=0,t=0;t<arguments[n].length;t++)o=arguments[n].charCodeAt(t)+(o<<6)+(o<<16)-o;i+=o}else i=arguments[n];this.seed+=(arguments.length-n)*i}return this.mt=this.mersenne_twister(this.seed),this.bimd5=this.blueimp_md5(),this.random=function(){return this.mt.random(this.seed)},this}function e(a,e){if(a=a||{},e)for(var n in e)void 0===a[n]&&(a[n]=e[n]);return a}function n(a,e){if(a)throw new RangeError(e)}function i(a){return function(){return this.natural(a)}}function r(a,e){for(var n,i=p(a),r=0,o=i.length;r<o;r++)e[n=i[r]]=a[n]||e[n]}function o(a,e){for(var n=0,i=a.length;n<i;n++)e[n]=a[n]}function t(a,e){var n=Array.isArray(a),i=e||(n?new Array(a.length):{});return n?o(a,i):r(a,i),i}var s=9007199254740992,l="abcdefghijklmnopqrstuvwxyz",c=l.toUpperCase(),m="0123456789abcdef",u=Array.prototype.slice;a.prototype.VERSION="1.0.13";var d=function(){throw new Error("No Base64 encoder available.")};"function"==typeof btoa?d=btoa:"function"==typeof Buffer&&(d=function(a){return new Buffer(a).toString("base64")}),a.prototype.bool=function(a){return a=e(a,{likelihood:50}),n(a.likelihood<0||a.likelihood>100,"Chance: Likelihood accepts values from 0 to 100."),100*this.random()<a.likelihood},a.prototype.animal=function(a){return void 0!==(a=e(a)).type?(n(!this.get("animals")[a.type.toLowerCase()],"Please pick from desert, ocean, grassland, forest, zoo, pets, farm."),this.pick(this.get("animals")[a.type.toLowerCase()])):(animalTypeArray=["desert","forest","ocean","zoo","farm","pet","grassland"],this.pick(this.get("animals")[this.pick(animalTypeArray)]))},a.prototype.character=function(a){n((a=e(a)).alpha&&a.symbols,"Chance: Cannot specify both alpha and symbols.");var i,r;return i="lower"===a.casing?l:"upper"===a.casing?c:l+c,(r=a.pool?a.pool:a.alpha?i:a.symbols?"!@#$%^&*()[]":i+"0123456789!@#$%^&*()[]").charAt(this.natural({max:r.length-1}))},a.prototype.floating=function(a){n((a=e(a,{fixed:4})).fixed&&a.precision,"Chance: Cannot specify both fixed and precision.");var i,r=Math.pow(10,a.fixed),o=s/r,t=-o;n(a.min&&a.fixed&&a.min<t,"Chance: Min specified is out of range with fixed. Min should be, at least, "+t),n(a.max&&a.fixed&&a.max>o,"Chance: Max specified is out of range with fixed. Max should be, at most, "+o),a=e(a,{min:t,max:o});var l=((i=this.integer({min:a.min*r,max:a.max*r}))/r).toFixed(a.fixed);return parseFloat(l)},a.prototype.integer=function(a){return a=e(a,{min:-9007199254740992,max:s}),n(a.min>a.max,"Chance: Min cannot be greater than Max."),Math.floor(this.random()*(a.max-a.min+1)+a.min)},a.prototype.natural=function(a){return"number"==typeof(a=e(a,{min:0,max:s})).numerals&&(n(a.numerals<1,"Chance: Numerals cannot be less than one."),a.min=Math.pow(10,a.numerals-1),a.max=Math.pow(10,a.numerals)-1),n(a.min<0,"Chance: Min cannot be less than zero."),this.integer(a)},a.prototype.hex=function(a){n((a=e(a,{min:0,max:s,casing:"lower"})).min<0,"Chance: Min cannot be less than zero.");var i=this.natural({min:a.min,max:a.max});return"upper"===a.casing?i.toString(16).toUpperCase():i.toString(16)},a.prototype.letter=function(a){a=e(a,{casing:"lower"});var n=this.character({pool:"abcdefghijklmnopqrstuvwxyz"});return"upper"===a.casing&&(n=n.toUpperCase()),n},a.prototype.string=function(a){n((a=e(a,{length:this.natural({min:5,max:20})})).length<0,"Chance: Length cannot be less than zero.");var i=a.length;return this.n(this.character,i,a).join("")},a.prototype.capitalize=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},a.prototype.mixin=function(e){for(var n in e)a.prototype[n]=e[n];return this},a.prototype.unique=function(a,e,i){n("function"!=typeof a,"Chance: The first argument must be a function.");var r=function(a,e){return-1!==a.indexOf(e)};i&&(r=i.comparator||r);for(var o,t=[],s=0,l=50*e,c=u.c
//# sourceMappingURL=chance.min.js.map