1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function () {
|
7 |
|
8 |
|
9 | var MAX_INT = 9007199254740992;
|
10 | var MIN_INT = -MAX_INT;
|
11 | var NUMBERS = '0123456789';
|
12 | var CHARS_LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
13 | var CHARS_UPPER = CHARS_LOWER.toUpperCase();
|
14 | var HEX_POOL = NUMBERS + "abcdef";
|
15 |
|
16 |
|
17 | var slice = Array.prototype.slice;
|
18 |
|
19 |
|
20 | function Chance (seed) {
|
21 | if (!(this instanceof Chance)) {
|
22 | return new Chance(seed);
|
23 | }
|
24 |
|
25 | if (seed !== undefined) {
|
26 |
|
27 | if (typeof seed === 'function') {
|
28 | this.random = seed;
|
29 | } else {
|
30 | this.seed = seed;
|
31 | }
|
32 | }
|
33 |
|
34 |
|
35 | if (typeof this.random === 'undefined') {
|
36 | this.mt = this.mersenne_twister(seed);
|
37 | this.random = function () {
|
38 | return this.mt.random(this.seed);
|
39 | };
|
40 | }
|
41 |
|
42 | return this;
|
43 | }
|
44 |
|
45 | Chance.prototype.VERSION = "0.6.1";
|
46 |
|
47 |
|
48 | function initOptions(options, defaults) {
|
49 | options || (options = {});
|
50 |
|
51 | if (defaults) {
|
52 | for (var i in defaults) {
|
53 | if (typeof options[i] === 'undefined') {
|
54 | options[i] = defaults[i];
|
55 | }
|
56 | }
|
57 | }
|
58 |
|
59 | return options;
|
60 | }
|
61 |
|
62 | function testRange(test, errorMessage) {
|
63 | if (test) {
|
64 | throw new RangeError(errorMessage);
|
65 | }
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 | Chance.prototype.bool = function (options) {
|
71 |
|
72 |
|
73 | options = initOptions(options, {likelihood : 50});
|
74 |
|
75 | testRange(
|
76 | options.likelihood < 0 || options.likelihood > 100,
|
77 | "Chance: Likelihood accepts values from 0 to 100."
|
78 | );
|
79 |
|
80 | return this.random() * 100 < options.likelihood;
|
81 | };
|
82 |
|
83 | Chance.prototype.character = function (options) {
|
84 | options = initOptions(options);
|
85 |
|
86 | var symbols = "!@#$%^&*()[]",
|
87 | letters, pool;
|
88 |
|
89 | testRange(
|
90 | options.alpha && options.symbols,
|
91 | "Chance: Cannot specify both alpha and symbols."
|
92 | );
|
93 |
|
94 |
|
95 | if (options.casing === 'lower') {
|
96 | letters = CHARS_LOWER;
|
97 | } else if (options.casing === 'upper') {
|
98 | letters = CHARS_UPPER;
|
99 | } else {
|
100 | letters = CHARS_LOWER + CHARS_UPPER;
|
101 | }
|
102 |
|
103 | if (options.pool) {
|
104 | pool = options.pool;
|
105 | } else if (options.alpha) {
|
106 | pool = letters;
|
107 | } else if (options.symbols) {
|
108 | pool = symbols;
|
109 | } else {
|
110 | pool = letters + NUMBERS + symbols;
|
111 | }
|
112 |
|
113 | return pool.charAt(this.natural({max: (pool.length - 1)}));
|
114 | };
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | Chance.prototype.floating = function (options) {
|
123 | var num;
|
124 |
|
125 | options = initOptions(options, {fixed : 4});
|
126 | var fixed = Math.pow(10, options.fixed);
|
127 |
|
128 | testRange(
|
129 | options.fixed && options.precision,
|
130 | "Chance: Cannot specify both fixed and precision."
|
131 | );
|
132 |
|
133 | var max = MAX_INT / fixed;
|
134 | var min = -max;
|
135 |
|
136 | testRange(
|
137 | options.min && options.fixed && options.min < min,
|
138 | "Chance: Min specified is out of range with fixed. Min should be, at least, " + min
|
139 | );
|
140 | testRange(
|
141 | options.max && options.fixed && options.max > max,
|
142 | "Chance: Max specified is out of range with fixed. Max should be, at most, " + max
|
143 | );
|
144 |
|
145 | options = initOptions(options, {min : min, max : max});
|
146 |
|
147 |
|
148 |
|
149 |
|
150 | num = this.integer({min: options.min * fixed, max: options.max * fixed});
|
151 | var num_fixed = (num / fixed).toFixed(options.fixed);
|
152 |
|
153 | return parseFloat(num_fixed);
|
154 | };
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 | Chance.prototype.integer = function (options) {
|
163 |
|
164 |
|
165 |
|
166 | options = initOptions(options, {min: MIN_INT, max: MAX_INT});
|
167 |
|
168 | testRange(options.min > options.max, "Chance: Min cannot be greater than Max.");
|
169 |
|
170 | return Math.floor(this.random() * (options.max - options.min + 1) + options.min);
|
171 | };
|
172 |
|
173 | Chance.prototype.natural = function (options) {
|
174 | options = initOptions(options, {min: 0, max: MAX_INT});
|
175 | return this.integer(options);
|
176 | };
|
177 |
|
178 | Chance.prototype.string = function (options) {
|
179 | options = initOptions(options);
|
180 |
|
181 | var length = options.length || this.natural({min: 5, max: 20}),
|
182 | pool = options.pool,
|
183 | text = this.n(this.character, length, {pool: pool});
|
184 |
|
185 | return text.join("");
|
186 | };
|
187 |
|
188 |
|
189 |
|
190 |
|
191 |
|
192 | Chance.prototype.capitalize = function (word) {
|
193 | return word.charAt(0).toUpperCase() + word.substr(1);
|
194 | };
|
195 |
|
196 | Chance.prototype.mixin = function (obj) {
|
197 | for (var func_name in obj) {
|
198 | Chance.prototype[func_name] = obj[func_name];
|
199 | }
|
200 | return this;
|
201 | };
|
202 |
|
203 |
|
204 |
|
205 | Chance.prototype.unique = function(fn, num, options) {
|
206 | options = initOptions(options, {
|
207 |
|
208 |
|
209 | comparator: function(arr, val) {
|
210 | return arr.indexOf(val) !== -1;
|
211 | }
|
212 | });
|
213 |
|
214 | var arr = [], count = 0, result, MAX_DUPLICATES = num * 50, params = slice.call(arguments, 2);
|
215 |
|
216 | while (arr.length < num) {
|
217 | result = fn.apply(this, params);
|
218 | if (!options.comparator(arr, result)) {
|
219 | arr.push(result);
|
220 |
|
221 | count = 0;
|
222 | }
|
223 |
|
224 | if (++count > MAX_DUPLICATES) {
|
225 | throw new RangeError("Chance: num is likely too large for sample set");
|
226 | }
|
227 | }
|
228 | return arr;
|
229 | };
|
230 |
|
231 | |
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 | Chance.prototype.n = function(fn, n, options) {
|
239 | var i = n || 1, arr = [], params = slice.call(arguments, 2);
|
240 |
|
241 | for (null; i--; null) {
|
242 | arr.push(fn.apply(this, params));
|
243 | }
|
244 |
|
245 | return arr;
|
246 | };
|
247 |
|
248 |
|
249 | Chance.prototype.pad = function (number, width, pad) {
|
250 |
|
251 | pad = pad || '0';
|
252 |
|
253 | number = number + '';
|
254 | return number.length >= width ? number : new Array(width - number.length + 1).join(pad) + number;
|
255 | };
|
256 |
|
257 | Chance.prototype.pick = function (arr, count) {
|
258 | if (!count || count === 1) {
|
259 | return arr[this.natural({max: arr.length - 1})];
|
260 | } else {
|
261 | return this.shuffle(arr).slice(0, count);
|
262 | }
|
263 | };
|
264 |
|
265 | Chance.prototype.shuffle = function (arr) {
|
266 | var old_array = arr.slice(0),
|
267 | new_array = [],
|
268 | j = 0,
|
269 | length = Number(old_array.length);
|
270 |
|
271 | for (var i = 0; i < length; i++) {
|
272 |
|
273 | j = this.natural({max: old_array.length - 1});
|
274 |
|
275 | new_array[i] = old_array[j];
|
276 |
|
277 | old_array.splice(j, 1);
|
278 | }
|
279 |
|
280 | return new_array;
|
281 | };
|
282 |
|
283 |
|
284 | Chance.prototype.weighted = function(arr, weights) {
|
285 | if (arr.length !== weights.length) {
|
286 | throw new RangeError("Chance: length of array and weights must match");
|
287 | }
|
288 |
|
289 |
|
290 |
|
291 | if (weights.some(function(weight) { return weight < 1; })) {
|
292 | var min = weights.reduce(function(min, weight) {
|
293 | return (weight < min) ? weight : min;
|
294 | }, weights[0]);
|
295 |
|
296 | var scaling_factor = 1 / min;
|
297 |
|
298 | weights = weights.map(function(weight) {
|
299 | return weight * scaling_factor;
|
300 | });
|
301 | }
|
302 |
|
303 | var sum = weights.reduce(function(total, weight) {
|
304 | return total + weight;
|
305 | }, 0);
|
306 |
|
307 |
|
308 | var selected = this.natural({ min: 1, max: sum });
|
309 |
|
310 | var total = 0;
|
311 | var chosen;
|
312 |
|
313 | weights.some(function(weight, index) {
|
314 | if (selected <= total + weight) {
|
315 | chosen = arr[index];
|
316 | return true;
|
317 | }
|
318 | total += weight;
|
319 | return false;
|
320 | });
|
321 |
|
322 | return chosen;
|
323 | };
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 | Chance.prototype.paragraph = function (options) {
|
330 | options = initOptions(options);
|
331 |
|
332 | var sentences = options.sentences || this.natural({min: 3, max: 7}),
|
333 | sentence_array = this.n(this.sentence, sentences);
|
334 |
|
335 | return sentence_array.join(' ');
|
336 | };
|
337 |
|
338 |
|
339 |
|
340 | Chance.prototype.sentence = function (options) {
|
341 | options = initOptions(options);
|
342 |
|
343 | var words = options.words || this.natural({min: 12, max: 18}),
|
344 | text, word_array = this.n(this.word, words);
|
345 |
|
346 | text = word_array.join(' ');
|
347 |
|
348 |
|
349 | text = this.capitalize(text) + '.';
|
350 |
|
351 | return text;
|
352 | };
|
353 |
|
354 | Chance.prototype.syllable = function (options) {
|
355 | options = initOptions(options);
|
356 |
|
357 | var length = options.length || this.natural({min: 2, max: 3}),
|
358 | consonants = 'bcdfghjklmnprstvwz',
|
359 | vowels = 'aeiou',
|
360 | all = consonants + vowels,
|
361 | text = '',
|
362 | chr;
|
363 |
|
364 |
|
365 |
|
366 | for (var i = 0; i < length; i++) {
|
367 | if (i === 0) {
|
368 |
|
369 | chr = this.character({pool: all});
|
370 | } else if (consonants.indexOf(chr) === -1) {
|
371 |
|
372 | chr = this.character({pool: consonants});
|
373 | } else {
|
374 |
|
375 | chr = this.character({pool: vowels});
|
376 | }
|
377 |
|
378 | text += chr;
|
379 | }
|
380 |
|
381 | return text;
|
382 | };
|
383 |
|
384 | Chance.prototype.word = function (options) {
|
385 | options = initOptions(options);
|
386 |
|
387 | testRange(
|
388 | options.syllables && options.length,
|
389 | "Chance: Cannot specify both syllables AND length."
|
390 | );
|
391 |
|
392 | var syllables = options.syllables || this.natural({min: 1, max: 3}),
|
393 | text = '';
|
394 |
|
395 | if (options.length) {
|
396 |
|
397 | do {
|
398 | text += this.syllable();
|
399 | } while (text.length < options.length);
|
400 | text = text.substring(0, options.length);
|
401 | } else {
|
402 |
|
403 | for (var i = 0; i < syllables; i++) {
|
404 | text += this.syllable();
|
405 | }
|
406 | }
|
407 | return text;
|
408 | };
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 | Chance.prototype.age = function (options) {
|
415 | options = initOptions(options);
|
416 | var ageRange;
|
417 |
|
418 | switch (options.type) {
|
419 | case 'child':
|
420 | ageRange = {min: 1, max: 12};
|
421 | break;
|
422 | case 'teen':
|
423 | ageRange = {min: 13, max: 19};
|
424 | break;
|
425 | case 'adult':
|
426 | ageRange = {min: 18, max: 65};
|
427 | break;
|
428 | case 'senior':
|
429 | ageRange = {min: 65, max: 100};
|
430 | break;
|
431 | case 'all':
|
432 | ageRange = {min: 1, max: 100};
|
433 | break;
|
434 | default:
|
435 | ageRange = {min: 18, max: 65};
|
436 | break;
|
437 | }
|
438 |
|
439 | return this.natural(ageRange);
|
440 | };
|
441 |
|
442 | Chance.prototype.birthday = function (options) {
|
443 | options = initOptions(options, {
|
444 | year: (new Date().getFullYear() - this.age(options))
|
445 | });
|
446 |
|
447 | return this.date(options);
|
448 | };
|
449 |
|
450 |
|
451 | Chance.prototype.cpf = function () {
|
452 | var n = this.n(this.natural, 9, { max: 9 });
|
453 | var d1 = n[8]*2+n[7]*3+n[6]*4+n[5]*5+n[4]*6+n[3]*7+n[2]*8+n[1]*9+n[0]*10;
|
454 | d1 = 11 - (d1 % 11);
|
455 | if (d1>=10) {
|
456 | d1 = 0;
|
457 | }
|
458 | var d2 = d1*2+n[8]*3+n[7]*4+n[6]*5+n[5]*6+n[4]*7+n[3]*8+n[2]*9+n[1]*10+n[0]*11;
|
459 | d2 = 11 - (d2 % 11);
|
460 | if (d2>=10) {
|
461 | d2 = 0;
|
462 | }
|
463 | return ''+n[0]+n[1]+n[2]+'.'+n[3]+n[4]+n[5]+'.'+n[6]+n[7]+n[8]+'-'+d1+d2;
|
464 | };
|
465 |
|
466 | Chance.prototype.first = function (options) {
|
467 | options = initOptions(options, {gender: this.gender()});
|
468 | return this.pick(this.get("firstNames")[options.gender.toLowerCase()]);
|
469 | };
|
470 |
|
471 | Chance.prototype.gender = function () {
|
472 | return this.pick(['Male', 'Female']);
|
473 | };
|
474 |
|
475 | Chance.prototype.last = function () {
|
476 | return this.pick(this.get("lastNames"));
|
477 | };
|
478 |
|
479 | Chance.prototype.name = function (options) {
|
480 | options = initOptions(options);
|
481 |
|
482 | var first = this.first(options),
|
483 | last = this.last(),
|
484 | name;
|
485 |
|
486 | if (options.middle) {
|
487 | name = first + ' ' + this.first(options) + ' ' + last;
|
488 | } else if (options.middle_initial) {
|
489 | name = first + ' ' + this.character({alpha: true, casing: 'upper'}) + '. ' + last;
|
490 | } else {
|
491 | name = first + ' ' + last;
|
492 | }
|
493 |
|
494 | if (options.prefix) {
|
495 | name = this.prefix(options) + ' ' + name;
|
496 | }
|
497 |
|
498 | return name;
|
499 | };
|
500 |
|
501 |
|
502 | Chance.prototype.name_prefixes = function (gender) {
|
503 | gender = gender || "all";
|
504 |
|
505 | var prefixes = [
|
506 | { name: 'Doctor', abbreviation: 'Dr.' }
|
507 | ];
|
508 |
|
509 | if (gender === "male" || gender === "all") {
|
510 | prefixes.push({ name: 'Mister', abbreviation: 'Mr.' });
|
511 | }
|
512 |
|
513 | if (gender === "female" || gender === "all") {
|
514 | prefixes.push({ name: 'Miss', abbreviation: 'Miss' });
|
515 | prefixes.push({ name: 'Misses', abbreviation: 'Mrs.' });
|
516 | }
|
517 |
|
518 | return prefixes;
|
519 | };
|
520 |
|
521 |
|
522 | Chance.prototype.prefix = function (options) {
|
523 | return this.name_prefix(options);
|
524 | };
|
525 |
|
526 | Chance.prototype.name_prefix = function (options) {
|
527 | options = initOptions(options, { gender: "all" });
|
528 | return options.full ?
|
529 | this.pick(this.name_prefixes(options.gender)).name :
|
530 | this.pick(this.name_prefixes(options.gender)).abbreviation;
|
531 | };
|
532 |
|
533 | Chance.prototype.ssn = function (options) {
|
534 | options = initOptions(options, {ssnFour: false, dashes: true});
|
535 | var ssn_pool = "1234567890",
|
536 | ssn,
|
537 | dash = options.dashes ? '-' : '';
|
538 |
|
539 | if(!options.ssnFour) {
|
540 | ssn = this.string({pool: ssn_pool, length: 3}) + dash +
|
541 | this.string({pool: ssn_pool, length: 2}) + dash +
|
542 | this.string({pool: ssn_pool, length: 4});
|
543 | } else {
|
544 | ssn = this.string({pool: ssn_pool, length: 4});
|
545 | }
|
546 | return ssn;
|
547 | };
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 | Chance.prototype.apple_token = function (options) {
|
555 | return this.string({ pool: "abcdef1234567890", length: 64 });
|
556 | };
|
557 |
|
558 | Chance.prototype.color = function (options) {
|
559 | function gray(value, delimiter) {
|
560 | return [value, value, value].join(delimiter || '');
|
561 | }
|
562 |
|
563 | options = initOptions(options, {format: this.pick(['hex', 'shorthex', 'rgb']), grayscale: false});
|
564 | var isGrayscale = options.grayscale;
|
565 |
|
566 | if (options.format === 'hex') {
|
567 | return '#' + (isGrayscale ? gray(this.hash({length: 2})) : this.hash({length: 6}));
|
568 | }
|
569 |
|
570 | if (options.format === 'shorthex') {
|
571 | return '#' + (isGrayscale ? gray(this.hash({length: 1})) : this.hash({length: 3}));
|
572 | }
|
573 |
|
574 | if (options.format === 'rgb') {
|
575 | if (isGrayscale) {
|
576 | return 'rgb(' + gray(this.natural({max: 255}), ',') + ')';
|
577 | } else {
|
578 | return 'rgb(' + this.natural({max: 255}) + ',' + this.natural({max: 255}) + ',' + this.natural({max: 255}) + ')';
|
579 | }
|
580 | }
|
581 |
|
582 | throw new Error('Invalid format provided. Please provide one of "hex", "shorthex", or "rgb"');
|
583 | };
|
584 |
|
585 | Chance.prototype.domain = function (options) {
|
586 | options = initOptions(options);
|
587 | return this.word() + '.' + (options.tld || this.tld());
|
588 | };
|
589 |
|
590 | Chance.prototype.email = function (options) {
|
591 | options = initOptions(options);
|
592 | return this.word({length: options.length}) + '@' + (options.domain || this.domain());
|
593 | };
|
594 |
|
595 | Chance.prototype.fbid = function () {
|
596 | return parseInt('10000' + this.natural({max: 100000000000}), 10);
|
597 | };
|
598 |
|
599 | Chance.prototype.google_analytics = function () {
|
600 | var account = this.pad(this.natural({max: 999999}), 6);
|
601 | var property = this.pad(this.natural({max: 99}), 2);
|
602 |
|
603 | return 'UA-' + account + '-' + property;
|
604 | };
|
605 |
|
606 | Chance.prototype.hashtag = function () {
|
607 | return '#' + this.word();
|
608 | };
|
609 |
|
610 | Chance.prototype.ip = function () {
|
611 |
|
612 |
|
613 | return this.natural({max: 255}) + '.' +
|
614 | this.natural({max: 255}) + '.' +
|
615 | this.natural({max: 255}) + '.' +
|
616 | this.natural({max: 255});
|
617 | };
|
618 |
|
619 | Chance.prototype.ipv6 = function () {
|
620 | var ip_addr = this.n(this.hash, 8, {length: 4});
|
621 |
|
622 | return ip_addr.join(":");
|
623 | };
|
624 |
|
625 | Chance.prototype.klout = function () {
|
626 | return this.natural({min: 1, max: 99});
|
627 | };
|
628 |
|
629 | Chance.prototype.tlds = function () {
|
630 | return ['com', 'org', 'edu', 'gov', 'co.uk', 'net', 'io'];
|
631 | };
|
632 |
|
633 | Chance.prototype.tld = function () {
|
634 | return this.pick(this.tlds());
|
635 | };
|
636 |
|
637 | Chance.prototype.twitter = function () {
|
638 | return '@' + this.word();
|
639 | };
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 | Chance.prototype.address = function (options) {
|
646 | options = initOptions(options);
|
647 | return this.natural({min: 5, max: 2000}) + ' ' + this.street(options);
|
648 | };
|
649 |
|
650 | Chance.prototype.altitude = function (options) {
|
651 | options = initOptions(options, {fixed : 5, max: 8848});
|
652 | return this.floating({min: 0, max: options.max, fixed: options.fixed});
|
653 | };
|
654 |
|
655 | Chance.prototype.areacode = function (options) {
|
656 | options = initOptions(options, {parens : true});
|
657 |
|
658 | var areacode = this.natural({min: 2, max: 9}).toString() +
|
659 | this.natural({min: 0, max: 8}).toString() +
|
660 | this.natural({min: 0, max: 9}).toString();
|
661 |
|
662 | return options.parens ? '(' + areacode + ')' : areacode;
|
663 | };
|
664 |
|
665 | Chance.prototype.city = function () {
|
666 | return this.capitalize(this.word({syllables: 3}));
|
667 | };
|
668 |
|
669 | Chance.prototype.coordinates = function (options) {
|
670 | options = initOptions(options);
|
671 | return this.latitude(options) + ', ' + this.longitude(options);
|
672 | };
|
673 |
|
674 | Chance.prototype.depth = function (options) {
|
675 | options = initOptions(options, {fixed: 5, min: -2550});
|
676 | return this.floating({min: options.min, max: 0, fixed: options.fixed});
|
677 | };
|
678 |
|
679 | Chance.prototype.geohash = function (options) {
|
680 | options = initOptions(options, { length: 7 });
|
681 | return this.string({ length: options.length, pool: '0123456789bcdefghjkmnpqrstuvwxyz' });
|
682 | };
|
683 |
|
684 | Chance.prototype.geojson = function (options) {
|
685 | options = initOptions(options);
|
686 | return this.latitude(options) + ', ' + this.longitude(options) + ', ' + this.altitude(options);
|
687 | };
|
688 |
|
689 | Chance.prototype.latitude = function (options) {
|
690 | options = initOptions(options, {fixed: 5, min: -90, max: 90});
|
691 | return this.floating({min: options.min, max: options.max, fixed: options.fixed});
|
692 | };
|
693 |
|
694 | Chance.prototype.longitude = function (options) {
|
695 | options = initOptions(options, {fixed: 5, min: -180, max: 180});
|
696 | return this.floating({min: options.min, max: options.max, fixed: options.fixed});
|
697 | };
|
698 |
|
699 | Chance.prototype.phone = function (options) {
|
700 | options = initOptions(options, {formatted : true});
|
701 | if (!options.formatted) {
|
702 | options.parens = false;
|
703 | }
|
704 | var areacode = this.areacode(options).toString();
|
705 | var exchange = this.natural({min: 2, max: 9}).toString() +
|
706 | this.natural({min: 0, max: 9}).toString() +
|
707 | this.natural({min: 0, max: 9}).toString();
|
708 |
|
709 | var subscriber = this.natural({min: 1000, max: 9999}).toString();
|
710 |
|
711 | return options.formatted ? areacode + ' ' + exchange + '-' + subscriber : areacode + exchange + subscriber;
|
712 | };
|
713 |
|
714 | Chance.prototype.postal = function () {
|
715 |
|
716 | var pd = this.character({pool: "XVTSRPNKLMHJGECBA"});
|
717 |
|
718 | var fsa = pd + this.natural({max: 9}) + this.character({alpha: true, casing: "upper"});
|
719 |
|
720 | var ldu = this.natural({max: 9}) + this.character({alpha: true, casing: "upper"}) + this.natural({max: 9});
|
721 |
|
722 | return fsa + " " + ldu;
|
723 | };
|
724 |
|
725 | Chance.prototype.provinces = function () {
|
726 | return this.get("provinces");
|
727 | };
|
728 |
|
729 | Chance.prototype.province = function (options) {
|
730 | return (options && options.full) ?
|
731 | this.pick(this.provinces()).name :
|
732 | this.pick(this.provinces()).abbreviation;
|
733 | };
|
734 |
|
735 | Chance.prototype.state = function (options) {
|
736 | return (options && options.full) ?
|
737 | this.pick(this.states(options)).name :
|
738 | this.pick(this.states(options)).abbreviation;
|
739 | };
|
740 |
|
741 | Chance.prototype.states = function (options) {
|
742 | options = initOptions(options);
|
743 |
|
744 | var states,
|
745 | us_states_and_dc = this.get("us_states_and_dc"),
|
746 | territories = this.get("territories"),
|
747 | armed_forces = this.get("armed_forces");
|
748 |
|
749 | states = us_states_and_dc;
|
750 |
|
751 | if (options.territories) {
|
752 | states = states.concat(territories);
|
753 | }
|
754 | if (options.armed_forces) {
|
755 | states = states.concat(armed_forces);
|
756 | }
|
757 |
|
758 | return states;
|
759 | };
|
760 |
|
761 | Chance.prototype.street = function (options) {
|
762 | options = initOptions(options);
|
763 |
|
764 | var street = this.word({syllables: 2});
|
765 | street = this.capitalize(street);
|
766 | street += ' ';
|
767 | street += options.short_suffix ?
|
768 | this.street_suffix().abbreviation :
|
769 | this.street_suffix().name;
|
770 | return street;
|
771 | };
|
772 |
|
773 | Chance.prototype.street_suffix = function () {
|
774 | return this.pick(this.street_suffixes());
|
775 | };
|
776 |
|
777 | Chance.prototype.street_suffixes = function () {
|
778 |
|
779 | return this.get("street_suffixes");
|
780 | };
|
781 |
|
782 |
|
783 |
|
784 | Chance.prototype.zip = function (options) {
|
785 | var zip = this.n(this.natural, 5, {max: 9});
|
786 |
|
787 | if (options && options.plusfour === true) {
|
788 | zip.push('-');
|
789 | zip = zip.concat(this.n(this.natural, 4, {max: 9}));
|
790 | }
|
791 |
|
792 | return zip.join("");
|
793 | };
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 | Chance.prototype.ampm = function () {
|
800 | return this.bool() ? 'am' : 'pm';
|
801 | };
|
802 |
|
803 | Chance.prototype.date = function (options) {
|
804 | var m = this.month({raw: true}),
|
805 | date_string;
|
806 |
|
807 | options = initOptions(options, {
|
808 | year: parseInt(this.year(), 10),
|
809 |
|
810 |
|
811 | month: m.numeric - 1,
|
812 | day: this.natural({min: 1, max: m.days}),
|
813 | hour: this.hour(),
|
814 | minute: this.minute(),
|
815 | second: this.second(),
|
816 | millisecond: this.millisecond(),
|
817 | american: true,
|
818 | string: false
|
819 | });
|
820 |
|
821 | var date = new Date(options.year, options.month, options.day, options.hour, options.minute, options.second, options.millisecond);
|
822 |
|
823 | if (options.american) {
|
824 |
|
825 |
|
826 | date_string = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
|
827 | } else {
|
828 | date_string = date.getDate() + '/' + (date.getMonth() + 1) + '/' + date.getFullYear();
|
829 | }
|
830 |
|
831 | return options.string ? date_string : date;
|
832 | };
|
833 |
|
834 | Chance.prototype.hammertime = function (options) {
|
835 | return this.date(options).getTime();
|
836 | };
|
837 |
|
838 | Chance.prototype.hour = function (options) {
|
839 | options = initOptions(options);
|
840 | var max = options.twentyfour ? 24 : 12;
|
841 | return this.natural({min: 1, max: max});
|
842 | };
|
843 |
|
844 | Chance.prototype.millisecond = function () {
|
845 | return this.natural({max: 999});
|
846 | };
|
847 |
|
848 | Chance.prototype.minute = Chance.prototype.second = function () {
|
849 | return this.natural({max: 59});
|
850 | };
|
851 |
|
852 | Chance.prototype.month = function (options) {
|
853 | options = initOptions(options);
|
854 | var month = this.pick(this.months());
|
855 | return options.raw ? month : month.name;
|
856 | };
|
857 |
|
858 | Chance.prototype.months = function () {
|
859 | return this.get("months");
|
860 | };
|
861 |
|
862 | Chance.prototype.second = function () {
|
863 | return this.natural({max: 59});
|
864 | };
|
865 |
|
866 | Chance.prototype.timestamp = function () {
|
867 | return this.natural({min: 1, max: parseInt(new Date().getTime() / 1000, 10)});
|
868 | };
|
869 |
|
870 | Chance.prototype.year = function (options) {
|
871 |
|
872 | options = initOptions(options, {min: new Date().getFullYear()});
|
873 |
|
874 |
|
875 | options.max = (typeof options.max !== "undefined") ? options.max : options.min + 100;
|
876 |
|
877 | return this.natural(options).toString();
|
878 | };
|
879 |
|
880 |
|
881 |
|
882 |
|
883 |
|
884 | Chance.prototype.cc = function (options) {
|
885 | options = initOptions(options);
|
886 |
|
887 | var type, number, to_generate;
|
888 |
|
889 | type = (options.type) ?
|
890 | this.cc_type({ name: options.type, raw: true }) :
|
891 | this.cc_type({ raw: true });
|
892 |
|
893 | number = type.prefix.split("");
|
894 | to_generate = type.length - type.prefix.length - 1;
|
895 |
|
896 |
|
897 | number = number.concat(this.n(this.integer, to_generate, {min: 0, max: 9}));
|
898 |
|
899 |
|
900 | number.push(this.luhn_calculate(number.join("")));
|
901 |
|
902 | return number.join("");
|
903 | };
|
904 |
|
905 | Chance.prototype.cc_types = function () {
|
906 |
|
907 | return this.get("cc_types");
|
908 | };
|
909 |
|
910 | Chance.prototype.cc_type = function (options) {
|
911 | options = initOptions(options);
|
912 | var types = this.cc_types(),
|
913 | type = null;
|
914 |
|
915 | if (options.name) {
|
916 | for (var i = 0; i < types.length; i++) {
|
917 |
|
918 | if (types[i].name === options.name || types[i].short_name === options.name) {
|
919 | type = types[i];
|
920 | break;
|
921 | }
|
922 | }
|
923 | if (type === null) {
|
924 | throw new Error("Credit card type '" + options.name + "'' is not supported");
|
925 | }
|
926 | } else {
|
927 | type = this.pick(types);
|
928 | }
|
929 |
|
930 | return options.raw ? type : type.name;
|
931 | };
|
932 |
|
933 |
|
934 | Chance.prototype.currency_types = function () {
|
935 | return this.get("currency_types");
|
936 | };
|
937 |
|
938 |
|
939 | Chance.prototype.currency = function () {
|
940 | return this.pick(this.currency_types());
|
941 | };
|
942 |
|
943 |
|
944 | Chance.prototype.currency_pair = function (returnAsString) {
|
945 | var currencies = this.unique(this.currency, 2, {
|
946 | comparator: function(arr, val) {
|
947 |
|
948 | return arr.reduce(function(acc, item) {
|
949 |
|
950 | return acc || (item.code === val.code);
|
951 | }, false);
|
952 | }
|
953 | });
|
954 |
|
955 | if (returnAsString) {
|
956 | return currencies[0] + '/' + currencies[1];
|
957 | } else {
|
958 | return currencies;
|
959 | }
|
960 | };
|
961 |
|
962 | Chance.prototype.dollar = function (options) {
|
963 |
|
964 | options = initOptions(options, {max : 10000, min : 0});
|
965 |
|
966 | var dollar = this.floating({min: options.min, max: options.max, fixed: 2}).toString(),
|
967 | cents = dollar.split('.')[1];
|
968 |
|
969 | if (cents === undefined) {
|
970 | dollar += '.00';
|
971 | } else if (cents.length < 2) {
|
972 | dollar = dollar + '0';
|
973 | }
|
974 |
|
975 | if (dollar < 0) {
|
976 | return '-$' + dollar.replace('-', '');
|
977 | } else {
|
978 | return '$' + dollar;
|
979 | }
|
980 | };
|
981 |
|
982 | Chance.prototype.exp = function (options) {
|
983 | options = initOptions(options);
|
984 | var exp = {};
|
985 |
|
986 | exp.year = this.exp_year();
|
987 |
|
988 |
|
989 |
|
990 | if (exp.year === (new Date().getFullYear())) {
|
991 | exp.month = this.exp_month({future: true});
|
992 | } else {
|
993 | exp.month = this.exp_month();
|
994 | }
|
995 |
|
996 | return options.raw ? exp : exp.month + '/' + exp.year;
|
997 | };
|
998 |
|
999 | Chance.prototype.exp_month = function (options) {
|
1000 | options = initOptions(options);
|
1001 | var month, month_int,
|
1002 | curMonth = new Date().getMonth();
|
1003 |
|
1004 | if (options.future) {
|
1005 | do {
|
1006 | month = this.month({raw: true}).numeric;
|
1007 | month_int = parseInt(month, 10);
|
1008 | } while (month_int < curMonth);
|
1009 | } else {
|
1010 | month = this.month({raw: true}).numeric;
|
1011 | }
|
1012 |
|
1013 | return month;
|
1014 | };
|
1015 |
|
1016 | Chance.prototype.exp_year = function () {
|
1017 | return this.year({max: new Date().getFullYear() + 10});
|
1018 | };
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 | function diceFn (range) {
|
1026 | return function () {
|
1027 | return this.natural(range);
|
1028 | };
|
1029 | }
|
1030 | Chance.prototype.d4 = diceFn({min: 1, max: 4});
|
1031 | Chance.prototype.d6 = diceFn({min: 1, max: 6});
|
1032 | Chance.prototype.d8 = diceFn({min: 1, max: 8});
|
1033 | Chance.prototype.d10 = diceFn({min: 1, max: 10});
|
1034 | Chance.prototype.d12 = diceFn({min: 1, max: 12});
|
1035 | Chance.prototype.d20 = diceFn({min: 1, max: 20});
|
1036 | Chance.prototype.d30 = diceFn({min: 1, max: 30});
|
1037 | Chance.prototype.d100 = diceFn({min: 1, max: 100});
|
1038 |
|
1039 | Chance.prototype.rpg = function (thrown, options) {
|
1040 | options = initOptions(options);
|
1041 | if (thrown === null) {
|
1042 | throw new Error("A type of die roll must be included");
|
1043 | } else {
|
1044 | var bits = thrown.toLowerCase().split("d"),
|
1045 | rolls = [];
|
1046 |
|
1047 | if (bits.length !== 2 || !parseInt(bits[0], 10) || !parseInt(bits[1], 10)) {
|
1048 | throw new Error("Invalid format provided. Please provide #d# where the first # is the number of dice to roll, the second # is the max of each die");
|
1049 | }
|
1050 | for (var i = bits[0]; i > 0; i--) {
|
1051 | rolls[i - 1] = this.natural({min: 1, max: bits[1]});
|
1052 | }
|
1053 | return (typeof options.sum !== 'undefined' && options.sum) ? rolls.reduce(function (p, c) { return p + c; }) : rolls;
|
1054 | }
|
1055 | };
|
1056 |
|
1057 |
|
1058 | Chance.prototype.guid = function (options) {
|
1059 | options = initOptions(options, { version: 5 });
|
1060 |
|
1061 | var guid_pool = "abcdef1234567890",
|
1062 | variant_pool = "ab89",
|
1063 | guid = this.string({ pool: guid_pool, length: 8 }) + '-' +
|
1064 | this.string({ pool: guid_pool, length: 4 }) + '-' +
|
1065 |
|
1066 | options.version +
|
1067 | this.string({ pool: guid_pool, length: 3 }) + '-' +
|
1068 |
|
1069 | this.string({ pool: variant_pool, length: 1 }) +
|
1070 | this.string({ pool: guid_pool, length: 3 }) + '-' +
|
1071 | this.string({ pool: guid_pool, length: 12 });
|
1072 | return guid;
|
1073 | };
|
1074 |
|
1075 |
|
1076 | Chance.prototype.hash = function (options) {
|
1077 | options = initOptions(options, {length : 40, casing: 'lower'});
|
1078 | var pool = options.casing === 'upper' ? HEX_POOL.toUpperCase() : HEX_POOL;
|
1079 | return this.string({pool: pool, length: options.length});
|
1080 | };
|
1081 |
|
1082 | Chance.prototype.luhn_check = function (num) {
|
1083 | var str = num.toString();
|
1084 | var checkDigit = +str.substring(str.length - 1);
|
1085 | return checkDigit === this.luhn_calculate(+str.substring(0, str.length - 1));
|
1086 | };
|
1087 |
|
1088 | Chance.prototype.luhn_calculate = function (num) {
|
1089 | var digits = num.toString().split("").reverse();
|
1090 | var sum = 0;
|
1091 | var digit;
|
1092 |
|
1093 | for (var i = 0, l = digits.length; l > i; ++i) {
|
1094 | digit = +digits[i];
|
1095 | if (i % 2 === 0) {
|
1096 | digit *= 2;
|
1097 | if (digit > 9) {
|
1098 | digit -= 9;
|
1099 | }
|
1100 | }
|
1101 | sum += digit;
|
1102 | }
|
1103 | return (sum * 9) % 10;
|
1104 | };
|
1105 |
|
1106 |
|
1107 | var data = {
|
1108 |
|
1109 | firstNames: {
|
1110 | "male": ["James", "John", "Robert", "Michael", "William", "David", "Richard", "Joseph", "Charles", "Thomas", "Christopher", "Daniel", "Matthew", "George", "Donald", "Anthony", "Paul", "Mark", "Edward", "Steven", "Kenneth", "Andrew", "Brian", "Joshua", "Kevin", "Ronald", "Timothy", "Jason", "Jeffrey", "Frank", "Gary", "Ryan", "Nicholas", "Eric", "Stephen", "Jacob", "Larry", "Jonathan", "Scott", "Raymond", "Justin", "Brandon", "Gregory", "Samuel", "Benjamin", "Patrick", "Jack", "Henry", "Walter", "Dennis", "Jerry", "Alexander", "Peter", "Tyler", "Douglas", "Harold", "Aaron", "Jose", "Adam", "Arthur", "Zachary", "Carl", "Nathan", "Albert", "Kyle", "Lawrence", "Joe", "Willie", "Gerald", "Roger", "Keith", "Jeremy", "Terry", "Harry", "Ralph", "Sean", "Jesse", "Roy", "Louis", "Billy", "Austin", "Bruce", "Eugene", "Christian", "Bryan", "Wayne", "Russell", "Howard", "Fred", "Ethan", "Jordan", "Philip", "Alan", "Juan", "Randy", "Vincent", "Bobby", "Dylan", "Johnny", "Phillip", "Victor", "Clarence", "Ernest", "Martin", "Craig", "Stanley", "Shawn", "Travis", "Bradley", "Leonard", "Earl", "Gabriel", "Jimmy", "Francis", "Todd", "Noah", "Danny", "Dale", "Cody", "Carlos", "Allen", "Frederick", "Logan", "Curtis", "Alex", "Joel", "Luis", "Norman", "Marvin", "Glenn", "Tony", "Nathaniel", "Rodney", "Melvin", "Alfred", "Steve", "Cameron", "Chad", "Edwin", "Caleb", "Evan", "Antonio", "Lee", "Herbert", "Jeffery", "Isaac", "Derek", "Ricky", "Marcus", "Theodore", "Elijah", "Luke", "Jesus", "Eddie", "Troy", "Mike", "Dustin", "Ray", "Adrian", "Bernard", "Leroy", "Angel", "Randall", "Wesley", "Ian", "Jared", "Mason", "Hunter", "Calvin", "Oscar", "Clifford", "Jay", "Shane", "Ronnie", "Barry", "Lucas", "Corey", "Manuel", "Leo", "Tommy", "Warren", "Jackson", "Isaiah", "Connor", "Don", "Dean", "Jon", "Julian", "Miguel", "Bill", "Lloyd", "Charlie", "Mitchell", "Leon", "Jerome", "Darrell", "Jeremiah", "Alvin", "Brett", "Seth", "Floyd", "Jim", "Blake", "Micheal", "Gordon", "Trevor", "Lewis", "Erik", "Edgar", "Vernon", "Devin", "Gavin", "Jayden", "Chris", "Clyde", "Tom", "Derrick", "Mario", "Brent", "Marc", "Herman", "Chase", "Dominic", "Ricardo", "Franklin", "Maurice", "Max", "Aiden", "Owen", "Lester", "Gilbert", "Elmer", "Gene", "Francisco", "Glen", "Cory", "Garrett", "Clayton", "Sam", "Jorge", "Chester", "Alejandro", "Jeff", "Harvey", "Milton", "Cole", "Ivan", "Andre", "Duane", "Landon"],
|
1111 | "female": ["Mary", "Emma", "Elizabeth", "Minnie", "Margaret", "Ida", "Alice", "Bertha", "Sarah", "Annie", "Clara", "Ella", "Florence", "Cora", "Martha", "Laura", "Nellie", "Grace", "Carrie", "Maude", "Mabel", "Bessie", "Jennie", "Gertrude", "Julia", "Hattie", "Edith", "Mattie", "Rose", "Catherine", "Lillian", "Ada", "Lillie", "Helen", "Jessie", "Louise", "Ethel", "Lula", "Myrtle", "Eva", "Frances", "Lena", "Lucy", "Edna", "Maggie", "Pearl", "Daisy", "Fannie", "Josephine", "Dora", "Rosa", "Katherine", "Agnes", "Marie", "Nora", "May", "Mamie", "Blanche", "Stella", "Ellen", "Nancy", "Effie", "Sallie", "Nettie", "Della", "Lizzie", "Flora", "Susie", "Maud", "Mae", "Etta", "Harriet", "Sadie", "Caroline", "Katie", "Lydia", "Elsie", "Kate", "Susan", "Mollie", "Alma", "Addie", "Georgia", "Eliza", "Lulu", "Nannie", "Lottie", "Amanda", "Belle", "Charlotte", "Rebecca", "Ruth", "Viola", "Olive", "Amelia", "Hannah", "Jane", "Virginia", "Emily", "Matilda", "Irene", "Kathryn", "Esther", "Willie", "Henrietta", "Ollie", "Amy", "Rachel", "Sara", "Estella", "Theresa", "Augusta", "Ora", "Pauline", "Josie", "Lola", "Sophia", "Leona", "Anne", "Mildred", "Ann", "Beulah", "Callie", "Lou", "Delia", "Eleanor", "Barbara", "Iva", "Louisa", "Maria", "Mayme", "Evelyn", "Estelle", "Nina", "Betty", "Marion", "Bettie", "Dorothy", "Luella", "Inez", "Lela", "Rosie", "Allie", "Millie", "Janie", "Cornelia", "Victoria", "Ruby", "Winifred", "Alta", "Celia", "Christine", "Beatrice", "Birdie", "Harriett", "Mable", "Myra", "Sophie", "Tillie", "Isabel", "Sylvia", "Carolyn", "Isabelle", "Leila", "Sally", "Ina", "Essie", "Bertie", "Nell", "Alberta", "Katharine", "Lora", "Rena", "Mina", "Rhoda", "Mathilda", "Abbie", "Eula", "Dollie", "Hettie", "Eunice", "Fanny", "Ola", "Lenora", "Adelaide", "Christina", "Lelia", "Nelle", "Sue", "Johanna", "Lilly", "Lucinda", "Minerva", "Lettie", "Roxie", "Cynthia", "Helena", "Hilda", "Hulda", "Bernice", "Genevieve", "Jean", "Cordelia", "Marian", "Francis", "Jeanette", "Adeline", "Gussie", "Leah", "Lois", "Lura", "Mittie", "Hallie", "Isabella", "Olga", "Phoebe", "Teresa", "Hester", "Lida", "Lina", "Winnie", "Claudia", "Marguerite", "Vera", "Cecelia", "Bess", "Emilie", "John", "Rosetta", "Verna", "Myrtie", "Cecilia", "Elva", "Olivia", "Ophelia", "Georgie", "Elnora", "Violet", "Adele", "Lily", "Linnie", "Loretta", "Madge", "Polly", "Virgie", "Eugenia", "Lucile", "Lucille", "Mabelle", "Rosalie"]
|
1112 | },
|
1113 |
|
1114 | lastNames: ['Smith', 'Johnson', 'Williams', 'Jones', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas', 'Jackson', 'White', 'Harris', 'Martin', 'Thompson', 'Garcia', 'Martinez', 'Robinson', 'Clark', 'Rodriguez', 'Lewis', 'Lee', 'Walker', 'Hall', 'Allen', 'Young', 'Hernandez', 'King', 'Wright', 'Lopez', 'Hill', 'Scott', 'Green', 'Adams', 'Baker', 'Gonzalez', 'Nelson', 'Carter', 'Mitchell', 'Perez', 'Roberts', 'Turner', 'Phillips', 'Campbell', 'Parker', 'Evans', 'Edwards', 'Collins', 'Stewart', 'Sanchez', 'Morris', 'Rogers', 'Reed', 'Cook', 'Morgan', 'Bell', 'Murphy', 'Bailey', 'Rivera', 'Cooper', 'Richardson', 'Cox', 'Howard', 'Ward', 'Torres', 'Peterson', 'Gray', 'Ramirez', 'James', 'Watson', 'Brooks', 'Kelly', 'Sanders', 'Price', 'Bennett', 'Wood', 'Barnes', 'Ross', 'Henderson', 'Coleman', 'Jenkins', 'Perry', 'Powell', 'Long', 'Patterson', 'Hughes', 'Flores', 'Washington', 'Butler', 'Simmons', 'Foster', 'Gonzales', 'Bryant', 'Alexander', 'Russell', 'Griffin', 'Diaz', 'Hayes', 'Myers', 'Ford', 'Hamilton', 'Graham', 'Sullivan', 'Wallace', 'Woods', 'Cole', 'West', 'Jordan', 'Owens', 'Reynolds', 'Fisher', 'Ellis', 'Harrison', 'Gibson', 'McDonald', 'Cruz', 'Marshall', 'Ortiz', 'Gomez', 'Murray', 'Freeman', 'Wells', 'Webb', 'Simpson', 'Stevens', 'Tucker', 'Porter', 'Hunter', 'Hicks', 'Crawford', 'Henry', 'Boyd', 'Mason', 'Morales', 'Kennedy', 'Warren', 'Dixon', 'Ramos', 'Reyes', 'Burns', 'Gordon', 'Shaw', 'Holmes', 'Rice', 'Robertson', 'Hunt', 'Black', 'Daniels', 'Palmer', 'Mills', 'Nichols', 'Grant', 'Knight', 'Ferguson', 'Rose', 'Stone', 'Hawkins', 'Dunn', 'Perkins', 'Hudson', 'Spencer', 'Gardner', 'Stephens', 'Payne', 'Pierce', 'Berry', 'Matthews', 'Arnold', 'Wagner', 'Willis', 'Ray', 'Watkins', 'Olson', 'Carroll', 'Duncan', 'Snyder', 'Hart', 'Cunningham', 'Bradley', 'Lane', 'Andrews', 'Ruiz', 'Harper', 'Fox', 'Riley', 'Armstrong', 'Carpenter', 'Weaver', 'Greene', 'Lawrence', 'Elliott', 'Chavez', 'Sims', 'Austin', 'Peters', 'Kelley', 'Franklin', 'Lawson', 'Fields', 'Gutierrez', 'Ryan', 'Schmidt', 'Carr', 'Vasquez', 'Castillo', 'Wheeler', 'Chapman', 'Oliver', 'Montgomery', 'Richards', 'Williamson', 'Johnston', 'Banks', 'Meyer', 'Bishop', 'McCoy', 'Howell', 'Alvarez', 'Morrison', 'Hansen', 'Fernandez', 'Garza', 'Harvey', 'Little', 'Burton', 'Stanley', 'Nguyen', 'George', 'Jacobs', 'Reid', 'Kim', 'Fuller', 'Lynch', 'Dean', 'Gilbert', 'Garrett', 'Romero', 'Welch', 'Larson', 'Frazier', 'Burke', 'Hanson', 'Day', 'Mendoza', 'Moreno', 'Bowman', 'Medina', 'Fowler', 'Brewer', 'Hoffman', 'Carlson', 'Silva', 'Pearson', 'Holland', 'Douglas', 'Fleming', 'Jensen', 'Vargas', 'Byrd', 'Davidson', 'Hopkins', 'May', 'Terry', 'Herrera', 'Wade', 'Soto', 'Walters', 'Curtis', 'Neal', 'Caldwell', 'Lowe', 'Jennings', 'Barnett', 'Graves', 'Jimenez', 'Horton', 'Shelton', 'Barrett', 'Obrien', 'Castro', 'Sutton', 'Gregory', 'McKinney', 'Lucas', 'Miles', 'Craig', 'Rodriquez', 'Chambers', 'Holt', 'Lambert', 'Fletcher', 'Watts', 'Bates', 'Hale', 'Rhodes', 'Pena', 'Beck', 'Newman', 'Haynes', 'McDaniel', 'Mendez', 'Bush', 'Vaughn', 'Parks', 'Dawson', 'Santiago', 'Norris', 'Hardy', 'Love', 'Steele', 'Curry', 'Powers', 'Schultz', 'Barker', 'Guzman', 'Page', 'Munoz', 'Ball', 'Keller', 'Chandler', 'Weber', 'Leonard', 'Walsh', 'Lyons', 'Ramsey', 'Wolfe', 'Schneider', 'Mullins', 'Benson', 'Sharp', 'Bowen', 'Daniel', 'Barber', 'Cummings', 'Hines', 'Baldwin', 'Griffith', 'Valdez', 'Hubbard', 'Salazar', 'Reeves', 'Warner', 'Stevenson', 'Burgess', 'Santos', 'Tate', 'Cross', 'Garner', 'Mann', 'Mack', 'Moss', 'Thornton', 'Dennis', 'McGee', 'Farmer', 'Delgado', 'Aguilar', 'Vega', 'Glover', 'Manning', 'Cohen', 'Harmon', 'Rodgers', 'Robbins', 'Newton', 'Todd', 'Blair', 'Higgins', 'Ingram', 'Reese', 'Cannon', 'Strickland', 'Townsend', 'Potter', 'Goodwin', 'Walton', 'Rowe', 'Hampton', 'Ortega', 'Patton', 'Swanson', 'Joseph', 'Francis', 'Goodman', 'Maldonado', 'Yates', 'Becker', 'Erickson', 'Hodges', 'Rios', 'Conner', 'Adkins', 'Webster', 'Norman', 'Malone', 'Hammond', 'Flowers', 'Cobb', 'Moody', 'Quinn', 'Blake', 'Maxwell', 'Pope', 'Floyd', 'Osborne', 'Paul', 'McCarthy', 'Guerrero', 'Lindsey', 'Estrada', 'Sandoval', 'Gibbs', 'Tyler', 'Gross', 'Fitzgerald', 'Stokes', 'Doyle', 'Sherman', 'Saunders', 'Wise', 'Colon', 'Gill', 'Alvarado', 'Greer', 'Padilla', 'Simon', 'Waters', 'Nunez', 'Ballard', 'Schwartz', 'McBride', 'Houston', 'Christensen', 'Klein', 'Pratt', 'Briggs', 'Parsons', 'McLaughlin', 'Zimmerman', 'French', 'Buchanan', 'Moran', 'Copeland', 'Roy', 'Pittman', 'Brady', 'McCormick', 'Holloway', 'Brock', 'Poole', 'Frank', 'Logan', 'Owen', 'Bass', 'Marsh', 'Drake', 'Wong', 'Jefferson', 'Park', 'Morton', 'Abbott', 'Sparks', 'Patrick', 'Norton', 'Huff', 'Clayton', 'Massey', 'Lloyd', 'Figueroa', 'Carson', 'Bowers', 'Roberson', 'Barton', 'Tran', 'Lamb', 'Harrington', 'Casey', 'Boone', 'Cortez', 'Clarke', 'Mathis', 'Singleton', 'Wilkins', 'Cain', 'Bryan', 'Underwood', 'Hogan', 'McKenzie', 'Collier', 'Luna', 'Phelps', 'McGuire', 'Allison', 'Bridges', 'Wilkerson', 'Nash', 'Summers', 'Atkins'],
|
1115 |
|
1116 | provinces: [
|
1117 | {name: 'Alberta', abbreviation: 'AB'},
|
1118 | {name: 'British Columbia', abbreviation: 'BC'},
|
1119 | {name: 'Manitoba', abbreviation: 'MB'},
|
1120 | {name: 'New Brunswick', abbreviation: 'NB'},
|
1121 | {name: 'Newfoundland and Labrador', abbreviation: 'NL'},
|
1122 | {name: 'Nova Scotia', abbreviation: 'NS'},
|
1123 | {name: 'Ontario', abbreviation: 'ON'},
|
1124 | {name: 'Prince Edward Island', abbreviation: 'PE'},
|
1125 | {name: 'Quebec', abbreviation: 'QC'},
|
1126 | {name: 'Saskatchewan', abbreviation: 'SK'},
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 | {name: 'Northwest Territories', abbreviation: 'NT'},
|
1132 | {name: 'Nunavut', abbreviation: 'NU'},
|
1133 | {name: 'Yukon', abbreviation: 'YT'}
|
1134 | ],
|
1135 |
|
1136 | us_states_and_dc: [
|
1137 | {name: 'Alabama', abbreviation: 'AL'},
|
1138 | {name: 'Alaska', abbreviation: 'AK'},
|
1139 | {name: 'Arizona', abbreviation: 'AZ'},
|
1140 | {name: 'Arkansas', abbreviation: 'AR'},
|
1141 | {name: 'California', abbreviation: 'CA'},
|
1142 | {name: 'Colorado', abbreviation: 'CO'},
|
1143 | {name: 'Connecticut', abbreviation: 'CT'},
|
1144 | {name: 'Delaware', abbreviation: 'DE'},
|
1145 | {name: 'District of Columbia', abbreviation: 'DC'},
|
1146 | {name: 'Florida', abbreviation: 'FL'},
|
1147 | {name: 'Georgia', abbreviation: 'GA'},
|
1148 | {name: 'Hawaii', abbreviation: 'HI'},
|
1149 | {name: 'Idaho', abbreviation: 'ID'},
|
1150 | {name: 'Illinois', abbreviation: 'IL'},
|
1151 | {name: 'Indiana', abbreviation: 'IN'},
|
1152 | {name: 'Iowa', abbreviation: 'IA'},
|
1153 | {name: 'Kansas', abbreviation: 'KS'},
|
1154 | {name: 'Kentucky', abbreviation: 'KY'},
|
1155 | {name: 'Louisiana', abbreviation: 'LA'},
|
1156 | {name: 'Maine', abbreviation: 'ME'},
|
1157 | {name: 'Maryland', abbreviation: 'MD'},
|
1158 | {name: 'Massachusetts', abbreviation: 'MA'},
|
1159 | {name: 'Michigan', abbreviation: 'MI'},
|
1160 | {name: 'Minnesota', abbreviation: 'MN'},
|
1161 | {name: 'Mississippi', abbreviation: 'MS'},
|
1162 | {name: 'Missouri', abbreviation: 'MO'},
|
1163 | {name: 'Montana', abbreviation: 'MT'},
|
1164 | {name: 'Nebraska', abbreviation: 'NE'},
|
1165 | {name: 'Nevada', abbreviation: 'NV'},
|
1166 | {name: 'New Hampshire', abbreviation: 'NH'},
|
1167 | {name: 'New Jersey', abbreviation: 'NJ'},
|
1168 | {name: 'New Mexico', abbreviation: 'NM'},
|
1169 | {name: 'New York', abbreviation: 'NY'},
|
1170 | {name: 'North Carolina', abbreviation: 'NC'},
|
1171 | {name: 'North Dakota', abbreviation: 'ND'},
|
1172 | {name: 'Ohio', abbreviation: 'OH'},
|
1173 | {name: 'Oklahoma', abbreviation: 'OK'},
|
1174 | {name: 'Oregon', abbreviation: 'OR'},
|
1175 | {name: 'Pennsylvania', abbreviation: 'PA'},
|
1176 | {name: 'Rhode Island', abbreviation: 'RI'},
|
1177 | {name: 'South Carolina', abbreviation: 'SC'},
|
1178 | {name: 'South Dakota', abbreviation: 'SD'},
|
1179 | {name: 'Tennessee', abbreviation: 'TN'},
|
1180 | {name: 'Texas', abbreviation: 'TX'},
|
1181 | {name: 'Utah', abbreviation: 'UT'},
|
1182 | {name: 'Vermont', abbreviation: 'VT'},
|
1183 | {name: 'Virginia', abbreviation: 'VA'},
|
1184 | {name: 'Washington', abbreviation: 'WA'},
|
1185 | {name: 'West Virginia', abbreviation: 'WV'},
|
1186 | {name: 'Wisconsin', abbreviation: 'WI'},
|
1187 | {name: 'Wyoming', abbreviation: 'WY'}
|
1188 | ],
|
1189 |
|
1190 | territories: [
|
1191 | {name: 'American Samoa', abbreviation: 'AS'},
|
1192 | {name: 'Federated States of Micronesia', abbreviation: 'FM'},
|
1193 | {name: 'Guam', abbreviation: 'GU'},
|
1194 | {name: 'Marshall Islands', abbreviation: 'MH'},
|
1195 | {name: 'Northern Mariana Islands', abbreviation: 'MP'},
|
1196 | {name: 'Puerto Rico', abbreviation: 'PR'},
|
1197 | {name: 'Virgin Islands, U.S.', abbreviation: 'VI'}
|
1198 | ],
|
1199 |
|
1200 | armed_forces: [
|
1201 | {name: 'Armed Forces Europe', abbreviation: 'AE'},
|
1202 | {name: 'Armed Forces Pacific', abbreviation: 'AP'},
|
1203 | {name: 'Armed Forces the Americas', abbreviation: 'AA'}
|
1204 | ],
|
1205 |
|
1206 | street_suffixes: [
|
1207 | {name: 'Avenue', abbreviation: 'Ave'},
|
1208 | {name: 'Boulevard', abbreviation: 'Blvd'},
|
1209 | {name: 'Center', abbreviation: 'Ctr'},
|
1210 | {name: 'Circle', abbreviation: 'Cir'},
|
1211 | {name: 'Court', abbreviation: 'Ct'},
|
1212 | {name: 'Drive', abbreviation: 'Dr'},
|
1213 | {name: 'Extension', abbreviation: 'Ext'},
|
1214 | {name: 'Glen', abbreviation: 'Gln'},
|
1215 | {name: 'Grove', abbreviation: 'Grv'},
|
1216 | {name: 'Heights', abbreviation: 'Hts'},
|
1217 | {name: 'Highway', abbreviation: 'Hwy'},
|
1218 | {name: 'Junction', abbreviation: 'Jct'},
|
1219 | {name: 'Key', abbreviation: 'Key'},
|
1220 | {name: 'Lane', abbreviation: 'Ln'},
|
1221 | {name: 'Loop', abbreviation: 'Loop'},
|
1222 | {name: 'Manor', abbreviation: 'Mnr'},
|
1223 | {name: 'Mill', abbreviation: 'Mill'},
|
1224 | {name: 'Park', abbreviation: 'Park'},
|
1225 | {name: 'Parkway', abbreviation: 'Pkwy'},
|
1226 | {name: 'Pass', abbreviation: 'Pass'},
|
1227 | {name: 'Path', abbreviation: 'Path'},
|
1228 | {name: 'Pike', abbreviation: 'Pike'},
|
1229 | {name: 'Place', abbreviation: 'Pl'},
|
1230 | {name: 'Plaza', abbreviation: 'Plz'},
|
1231 | {name: 'Point', abbreviation: 'Pt'},
|
1232 | {name: 'Ridge', abbreviation: 'Rdg'},
|
1233 | {name: 'River', abbreviation: 'Riv'},
|
1234 | {name: 'Road', abbreviation: 'Rd'},
|
1235 | {name: 'Square', abbreviation: 'Sq'},
|
1236 | {name: 'Street', abbreviation: 'St'},
|
1237 | {name: 'Terrace', abbreviation: 'Ter'},
|
1238 | {name: 'Trail', abbreviation: 'Trl'},
|
1239 | {name: 'Turnpike', abbreviation: 'Tpke'},
|
1240 | {name: 'View', abbreviation: 'Vw'},
|
1241 | {name: 'Way', abbreviation: 'Way'}
|
1242 | ],
|
1243 |
|
1244 | months: [
|
1245 | {name: 'January', short_name: 'Jan', numeric: '01', days: 31},
|
1246 |
|
1247 | {name: 'February', short_name: 'Feb', numeric: '02', days: 28},
|
1248 | {name: 'March', short_name: 'Mar', numeric: '03', days: 31},
|
1249 | {name: 'April', short_name: 'Apr', numeric: '04', days: 30},
|
1250 | {name: 'May', short_name: 'May', numeric: '05', days: 31},
|
1251 | {name: 'June', short_name: 'Jun', numeric: '06', days: 30},
|
1252 | {name: 'July', short_name: 'Jul', numeric: '07', days: 31},
|
1253 | {name: 'August', short_name: 'Aug', numeric: '08', days: 31},
|
1254 | {name: 'September', short_name: 'Sep', numeric: '09', days: 30},
|
1255 | {name: 'October', short_name: 'Oct', numeric: '10', days: 31},
|
1256 | {name: 'November', short_name: 'Nov', numeric: '11', days: 30},
|
1257 | {name: 'December', short_name: 'Dec', numeric: '12', days: 31}
|
1258 | ],
|
1259 |
|
1260 |
|
1261 | cc_types: [
|
1262 | {name: "American Express", short_name: 'amex', prefix: '34', length: 15},
|
1263 | {name: "Bankcard", short_name: 'bankcard', prefix: '5610', length: 16},
|
1264 | {name: "China UnionPay", short_name: 'chinaunion', prefix: '62', length: 16},
|
1265 | {name: "Diners Club Carte Blanche", short_name: 'dccarte', prefix: '300', length: 14},
|
1266 | {name: "Diners Club enRoute", short_name: 'dcenroute', prefix: '2014', length: 15},
|
1267 | {name: "Diners Club International", short_name: 'dcintl', prefix: '36', length: 14},
|
1268 | {name: "Diners Club United States & Canada", short_name: 'dcusc', prefix: '54', length: 16},
|
1269 | {name: "Discover Card", short_name: 'discover', prefix: '6011', length: 16},
|
1270 | {name: "InstaPayment", short_name: 'instapay', prefix: '637', length: 16},
|
1271 | {name: "JCB", short_name: 'jcb', prefix: '3528', length: 16},
|
1272 | {name: "Laser", short_name: 'laser', prefix: '6304', length: 16},
|
1273 | {name: "Maestro", short_name: 'maestro', prefix: '5018', length: 16},
|
1274 | {name: "Mastercard", short_name: 'mc', prefix: '51', length: 16},
|
1275 | {name: "Solo", short_name: 'solo', prefix: '6334', length: 16},
|
1276 | {name: "Switch", short_name: 'switch', prefix: '4903', length: 16},
|
1277 | {name: "Visa", short_name: 'visa', prefix: '4', length: 16},
|
1278 | {name: "Visa Electron", short_name: 'electron', prefix: '4026', length: 16}
|
1279 | ],
|
1280 |
|
1281 |
|
1282 | currency_types: [
|
1283 | {'code' : 'AED', 'name' : 'United Arab Emirates Dirham'},
|
1284 | {'code' : 'AFN', 'name' : 'Afghanistan Afghani'},
|
1285 | {'code' : 'ALL', 'name' : 'Albania Lek'},
|
1286 | {'code' : 'AMD', 'name' : 'Armenia Dram'},
|
1287 | {'code' : 'ANG', 'name' : 'Netherlands Antilles Guilder'},
|
1288 | {'code' : 'AOA', 'name' : 'Angola Kwanza'},
|
1289 | {'code' : 'ARS', 'name' : 'Argentina Peso'},
|
1290 | {'code' : 'AUD', 'name' : 'Australia Dollar'},
|
1291 | {'code' : 'AWG', 'name' : 'Aruba Guilder'},
|
1292 | {'code' : 'AZN', 'name' : 'Azerbaijan New Manat'},
|
1293 | {'code' : 'BAM', 'name' : 'Bosnia and Herzegovina Convertible Marka'},
|
1294 | {'code' : 'BBD', 'name' : 'Barbados Dollar'},
|
1295 | {'code' : 'BDT', 'name' : 'Bangladesh Taka'},
|
1296 | {'code' : 'BGN', 'name' : 'Bulgaria Lev'},
|
1297 | {'code' : 'BHD', 'name' : 'Bahrain Dinar'},
|
1298 | {'code' : 'BIF', 'name' : 'Burundi Franc'},
|
1299 | {'code' : 'BMD', 'name' : 'Bermuda Dollar'},
|
1300 | {'code' : 'BND', 'name' : 'Brunei Darussalam Dollar'},
|
1301 | {'code' : 'BOB', 'name' : 'Bolivia Boliviano'},
|
1302 | {'code' : 'BRL', 'name' : 'Brazil Real'},
|
1303 | {'code' : 'BSD', 'name' : 'Bahamas Dollar'},
|
1304 | {'code' : 'BTN', 'name' : 'Bhutan Ngultrum'},
|
1305 | {'code' : 'BWP', 'name' : 'Botswana Pula'},
|
1306 | {'code' : 'BYR', 'name' : 'Belarus Ruble'},
|
1307 | {'code' : 'BZD', 'name' : 'Belize Dollar'},
|
1308 | {'code' : 'CAD', 'name' : 'Canada Dollar'},
|
1309 | {'code' : 'CDF', 'name' : 'Congo/Kinshasa Franc'},
|
1310 | {'code' : 'CHF', 'name' : 'Switzerland Franc'},
|
1311 | {'code' : 'CLP', 'name' : 'Chile Peso'},
|
1312 | {'code' : 'CNY', 'name' : 'China Yuan Renminbi'},
|
1313 | {'code' : 'COP', 'name' : 'Colombia Peso'},
|
1314 | {'code' : 'CRC', 'name' : 'Costa Rica Colon'},
|
1315 | {'code' : 'CUC', 'name' : 'Cuba Convertible Peso'},
|
1316 | {'code' : 'CUP', 'name' : 'Cuba Peso'},
|
1317 | {'code' : 'CVE', 'name' : 'Cape Verde Escudo'},
|
1318 | {'code' : 'CZK', 'name' : 'Czech Republic Koruna'},
|
1319 | {'code' : 'DJF', 'name' : 'Djibouti Franc'},
|
1320 | {'code' : 'DKK', 'name' : 'Denmark Krone'},
|
1321 | {'code' : 'DOP', 'name' : 'Dominican Republic Peso'},
|
1322 | {'code' : 'DZD', 'name' : 'Algeria Dinar'},
|
1323 | {'code' : 'EGP', 'name' : 'Egypt Pound'},
|
1324 | {'code' : 'ERN', 'name' : 'Eritrea Nakfa'},
|
1325 | {'code' : 'ETB', 'name' : 'Ethiopia Birr'},
|
1326 | {'code' : 'EUR', 'name' : 'Euro Member Countries'},
|
1327 | {'code' : 'FJD', 'name' : 'Fiji Dollar'},
|
1328 | {'code' : 'FKP', 'name' : 'Falkland Islands (Malvinas) Pound'},
|
1329 | {'code' : 'GBP', 'name' : 'United Kingdom Pound'},
|
1330 | {'code' : 'GEL', 'name' : 'Georgia Lari'},
|
1331 | {'code' : 'GGP', 'name' : 'Guernsey Pound'},
|
1332 | {'code' : 'GHS', 'name' : 'Ghana Cedi'},
|
1333 | {'code' : 'GIP', 'name' : 'Gibraltar Pound'},
|
1334 | {'code' : 'GMD', 'name' : 'Gambia Dalasi'},
|
1335 | {'code' : 'GNF', 'name' : 'Guinea Franc'},
|
1336 | {'code' : 'GTQ', 'name' : 'Guatemala Quetzal'},
|
1337 | {'code' : 'GYD', 'name' : 'Guyana Dollar'},
|
1338 | {'code' : 'HKD', 'name' : 'Hong Kong Dollar'},
|
1339 | {'code' : 'HNL', 'name' : 'Honduras Lempira'},
|
1340 | {'code' : 'HRK', 'name' : 'Croatia Kuna'},
|
1341 | {'code' : 'HTG', 'name' : 'Haiti Gourde'},
|
1342 | {'code' : 'HUF', 'name' : 'Hungary Forint'},
|
1343 | {'code' : 'IDR', 'name' : 'Indonesia Rupiah'},
|
1344 | {'code' : 'ILS', 'name' : 'Israel Shekel'},
|
1345 | {'code' : 'IMP', 'name' : 'Isle of Man Pound'},
|
1346 | {'code' : 'INR', 'name' : 'India Rupee'},
|
1347 | {'code' : 'IQD', 'name' : 'Iraq Dinar'},
|
1348 | {'code' : 'IRR', 'name' : 'Iran Rial'},
|
1349 | {'code' : 'ISK', 'name' : 'Iceland Krona'},
|
1350 | {'code' : 'JEP', 'name' : 'Jersey Pound'},
|
1351 | {'code' : 'JMD', 'name' : 'Jamaica Dollar'},
|
1352 | {'code' : 'JOD', 'name' : 'Jordan Dinar'},
|
1353 | {'code' : 'JPY', 'name' : 'Japan Yen'},
|
1354 | {'code' : 'KES', 'name' : 'Kenya Shilling'},
|
1355 | {'code' : 'KGS', 'name' : 'Kyrgyzstan Som'},
|
1356 | {'code' : 'KHR', 'name' : 'Cambodia Riel'},
|
1357 | {'code' : 'KMF', 'name' : 'Comoros Franc'},
|
1358 | {'code' : 'KPW', 'name' : 'Korea (North) Won'},
|
1359 | {'code' : 'KRW', 'name' : 'Korea (South) Won'},
|
1360 | {'code' : 'KWD', 'name' : 'Kuwait Dinar'},
|
1361 | {'code' : 'KYD', 'name' : 'Cayman Islands Dollar'},
|
1362 | {'code' : 'KZT', 'name' : 'Kazakhstan Tenge'},
|
1363 | {'code' : 'LAK', 'name' : 'Laos Kip'},
|
1364 | {'code' : 'LBP', 'name' : 'Lebanon Pound'},
|
1365 | {'code' : 'LKR', 'name' : 'Sri Lanka Rupee'},
|
1366 | {'code' : 'LRD', 'name' : 'Liberia Dollar'},
|
1367 | {'code' : 'LSL', 'name' : 'Lesotho Loti'},
|
1368 | {'code' : 'LTL', 'name' : 'Lithuania Litas'},
|
1369 | {'code' : 'LYD', 'name' : 'Libya Dinar'},
|
1370 | {'code' : 'MAD', 'name' : 'Morocco Dirham'},
|
1371 | {'code' : 'MDL', 'name' : 'Moldova Leu'},
|
1372 | {'code' : 'MGA', 'name' : 'Madagascar Ariary'},
|
1373 | {'code' : 'MKD', 'name' : 'Macedonia Denar'},
|
1374 | {'code' : 'MMK', 'name' : 'Myanmar (Burma) Kyat'},
|
1375 | {'code' : 'MNT', 'name' : 'Mongolia Tughrik'},
|
1376 | {'code' : 'MOP', 'name' : 'Macau Pataca'},
|
1377 | {'code' : 'MRO', 'name' : 'Mauritania Ouguiya'},
|
1378 | {'code' : 'MUR', 'name' : 'Mauritius Rupee'},
|
1379 | {'code' : 'MVR', 'name' : 'Maldives (Maldive Islands) Rufiyaa'},
|
1380 | {'code' : 'MWK', 'name' : 'Malawi Kwacha'},
|
1381 | {'code' : 'MXN', 'name' : 'Mexico Peso'},
|
1382 | {'code' : 'MYR', 'name' : 'Malaysia Ringgit'},
|
1383 | {'code' : 'MZN', 'name' : 'Mozambique Metical'},
|
1384 | {'code' : 'NAD', 'name' : 'Namibia Dollar'},
|
1385 | {'code' : 'NGN', 'name' : 'Nigeria Naira'},
|
1386 | {'code' : 'NIO', 'name' : 'Nicaragua Cordoba'},
|
1387 | {'code' : 'NOK', 'name' : 'Norway Krone'},
|
1388 | {'code' : 'NPR', 'name' : 'Nepal Rupee'},
|
1389 | {'code' : 'NZD', 'name' : 'New Zealand Dollar'},
|
1390 | {'code' : 'OMR', 'name' : 'Oman Rial'},
|
1391 | {'code' : 'PAB', 'name' : 'Panama Balboa'},
|
1392 | {'code' : 'PEN', 'name' : 'Peru Nuevo Sol'},
|
1393 | {'code' : 'PGK', 'name' : 'Papua New Guinea Kina'},
|
1394 | {'code' : 'PHP', 'name' : 'Philippines Peso'},
|
1395 | {'code' : 'PKR', 'name' : 'Pakistan Rupee'},
|
1396 | {'code' : 'PLN', 'name' : 'Poland Zloty'},
|
1397 | {'code' : 'PYG', 'name' : 'Paraguay Guarani'},
|
1398 | {'code' : 'QAR', 'name' : 'Qatar Riyal'},
|
1399 | {'code' : 'RON', 'name' : 'Romania New Leu'},
|
1400 | {'code' : 'RSD', 'name' : 'Serbia Dinar'},
|
1401 | {'code' : 'RUB', 'name' : 'Russia Ruble'},
|
1402 | {'code' : 'RWF', 'name' : 'Rwanda Franc'},
|
1403 | {'code' : 'SAR', 'name' : 'Saudi Arabia Riyal'},
|
1404 | {'code' : 'SBD', 'name' : 'Solomon Islands Dollar'},
|
1405 | {'code' : 'SCR', 'name' : 'Seychelles Rupee'},
|
1406 | {'code' : 'SDG', 'name' : 'Sudan Pound'},
|
1407 | {'code' : 'SEK', 'name' : 'Sweden Krona'},
|
1408 | {'code' : 'SGD', 'name' : 'Singapore Dollar'},
|
1409 | {'code' : 'SHP', 'name' : 'Saint Helena Pound'},
|
1410 | {'code' : 'SLL', 'name' : 'Sierra Leone Leone'},
|
1411 | {'code' : 'SOS', 'name' : 'Somalia Shilling'},
|
1412 | {'code' : 'SPL', 'name' : 'Seborga Luigino'},
|
1413 | {'code' : 'SRD', 'name' : 'Suriname Dollar'},
|
1414 | {'code' : 'STD', 'name' : 'São Tomé and Príncipe Dobra'},
|
1415 | {'code' : 'SVC', 'name' : 'El Salvador Colon'},
|
1416 | {'code' : 'SYP', 'name' : 'Syria Pound'},
|
1417 | {'code' : 'SZL', 'name' : 'Swaziland Lilangeni'},
|
1418 | {'code' : 'THB', 'name' : 'Thailand Baht'},
|
1419 | {'code' : 'TJS', 'name' : 'Tajikistan Somoni'},
|
1420 | {'code' : 'TMT', 'name' : 'Turkmenistan Manat'},
|
1421 | {'code' : 'TND', 'name' : 'Tunisia Dinar'},
|
1422 | {'code' : 'TOP', 'name' : 'Tonga Pa\'anga'},
|
1423 | {'code' : 'TRY', 'name' : 'Turkey Lira'},
|
1424 | {'code' : 'TTD', 'name' : 'Trinidad and Tobago Dollar'},
|
1425 | {'code' : 'TVD', 'name' : 'Tuvalu Dollar'},
|
1426 | {'code' : 'TWD', 'name' : 'Taiwan New Dollar'},
|
1427 | {'code' : 'TZS', 'name' : 'Tanzania Shilling'},
|
1428 | {'code' : 'UAH', 'name' : 'Ukraine Hryvnia'},
|
1429 | {'code' : 'UGX', 'name' : 'Uganda Shilling'},
|
1430 | {'code' : 'USD', 'name' : 'United States Dollar'},
|
1431 | {'code' : 'UYU', 'name' : 'Uruguay Peso'},
|
1432 | {'code' : 'UZS', 'name' : 'Uzbekistan Som'},
|
1433 | {'code' : 'VEF', 'name' : 'Venezuela Bolivar'},
|
1434 | {'code' : 'VND', 'name' : 'Viet Nam Dong'},
|
1435 | {'code' : 'VUV', 'name' : 'Vanuatu Vatu'},
|
1436 | {'code' : 'WST', 'name' : 'Samoa Tala'},
|
1437 | {'code' : 'XAF', 'name' : 'Communauté Financière Africaine (BEAC) CFA Franc BEAC'},
|
1438 | {'code' : 'XCD', 'name' : 'East Caribbean Dollar'},
|
1439 | {'code' : 'XDR', 'name' : 'International Monetary Fund (IMF) Special Drawing Rights'},
|
1440 | {'code' : 'XOF', 'name' : 'Communauté Financière Africaine (BCEAO) Franc'},
|
1441 | {'code' : 'XPF', 'name' : 'Comptoirs Français du Pacifique (CFP) Franc'},
|
1442 | {'code' : 'YER', 'name' : 'Yemen Rial'},
|
1443 | {'code' : 'ZAR', 'name' : 'South Africa Rand'},
|
1444 | {'code' : 'ZMW', 'name' : 'Zambia Kwacha'},
|
1445 | {'code' : 'ZWD', 'name' : 'Zimbabwe Dollar'}
|
1446 | ]
|
1447 | };
|
1448 |
|
1449 | function copyObject(source, target) {
|
1450 | var key;
|
1451 |
|
1452 | target = target || (Array.isArray(source) ? [] : {});
|
1453 |
|
1454 | for (key in source) {
|
1455 | if (source.hasOwnProperty(key)) {
|
1456 | target[key] = source[key] || target[key];
|
1457 | }
|
1458 | }
|
1459 |
|
1460 | return target;
|
1461 | }
|
1462 |
|
1463 |
|
1464 | Chance.prototype.get = function (name) {
|
1465 | return copyObject(data[name]);
|
1466 | };
|
1467 |
|
1468 |
|
1469 | Chance.prototype.mac_address = function(options){
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 | options = initOptions(options);
|
1475 | if(!options.separator) {
|
1476 | options.separator = options.networkVersion ? "." : ":";
|
1477 | }
|
1478 |
|
1479 | var mac_pool="ABCDEF1234567890",
|
1480 | mac = "";
|
1481 | if(!options.networkVersion) {
|
1482 | mac = this.n(this.string, 6, { pool: mac_pool, length:2 }).join(options.separator);
|
1483 | } else {
|
1484 | mac = this.n(this.string, 3, { pool: mac_pool, length:4 }).join(options.separator);
|
1485 | }
|
1486 |
|
1487 | return mac;
|
1488 | };
|
1489 |
|
1490 | Chance.prototype.normal = function (options) {
|
1491 | options = initOptions(options, {mean : 0, dev : 1});
|
1492 |
|
1493 |
|
1494 | var s, u, v, norm,
|
1495 | mean = options.mean,
|
1496 | dev = options.dev;
|
1497 |
|
1498 | do {
|
1499 |
|
1500 | u = this.random() * 2 - 1;
|
1501 | v = this.random() * 2 - 1;
|
1502 |
|
1503 | s = u * u + v * v;
|
1504 | } while (s >= 1);
|
1505 |
|
1506 |
|
1507 | norm = u * Math.sqrt(-2 * Math.log(s) / s);
|
1508 |
|
1509 |
|
1510 | return dev * norm + mean;
|
1511 | };
|
1512 |
|
1513 | Chance.prototype.radio = function (options) {
|
1514 |
|
1515 | options = initOptions(options, {side : "?"});
|
1516 | var fl = "";
|
1517 | switch (options.side.toLowerCase()) {
|
1518 | case "east":
|
1519 | case "e":
|
1520 | fl = "W";
|
1521 | break;
|
1522 | case "west":
|
1523 | case "w":
|
1524 | fl = "K";
|
1525 | break;
|
1526 | default:
|
1527 | fl = this.character({pool: "KW"});
|
1528 | break;
|
1529 | }
|
1530 |
|
1531 | return fl + this.character({alpha: true, casing: "upper"}) +
|
1532 | this.character({alpha: true, casing: "upper"}) +
|
1533 | this.character({alpha: true, casing: "upper"});
|
1534 | };
|
1535 |
|
1536 |
|
1537 | Chance.prototype.set = function (name, values) {
|
1538 | if (typeof name === "string") {
|
1539 | data[name] = values;
|
1540 | } else {
|
1541 | data = copyObject(name, data);
|
1542 | }
|
1543 | };
|
1544 |
|
1545 | Chance.prototype.tv = function (options) {
|
1546 | return this.radio(options);
|
1547 | };
|
1548 |
|
1549 |
|
1550 |
|
1551 | Chance.prototype.mersenne_twister = function (seed) {
|
1552 | return new MersenneTwister(seed);
|
1553 | };
|
1554 |
|
1555 |
|
1556 | var MersenneTwister = function (seed) {
|
1557 | if (seed === undefined) {
|
1558 | seed = new Date().getTime();
|
1559 | }
|
1560 |
|
1561 | this.N = 624;
|
1562 | this.M = 397;
|
1563 | this.MATRIX_A = 0x9908b0df;
|
1564 | this.UPPER_MASK = 0x80000000;
|
1565 | this.LOWER_MASK = 0x7fffffff;
|
1566 |
|
1567 | this.mt = new Array(this.N);
|
1568 | this.mti = this.N + 1;
|
1569 |
|
1570 | this.init_genrand(seed);
|
1571 | };
|
1572 |
|
1573 |
|
1574 | MersenneTwister.prototype.init_genrand = function (s) {
|
1575 | this.mt[0] = s >>> 0;
|
1576 | for (this.mti = 1; this.mti < this.N; this.mti++) {
|
1577 | s = this.mt[this.mti - 1] ^ (this.mt[this.mti - 1] >>> 30);
|
1578 | this.mt[this.mti] = (((((s & 0xffff0000) >>> 16) * 1812433253) << 16) + (s & 0x0000ffff) * 1812433253) + this.mti;
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 | this.mt[this.mti] >>>= 0;
|
1584 |
|
1585 | }
|
1586 | };
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 | MersenneTwister.prototype.init_by_array = function (init_key, key_length) {
|
1593 | var i = 1, j = 0, k, s;
|
1594 | this.init_genrand(19650218);
|
1595 | k = (this.N > key_length ? this.N : key_length);
|
1596 | for (; k; k--) {
|
1597 | s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);
|
1598 | this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1664525) << 16) + ((s & 0x0000ffff) * 1664525))) + init_key[j] + j;
|
1599 | this.mt[i] >>>= 0;
|
1600 | i++;
|
1601 | j++;
|
1602 | if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
|
1603 | if (j >= key_length) { j = 0; }
|
1604 | }
|
1605 | for (k = this.N - 1; k; k--) {
|
1606 | s = this.mt[i - 1] ^ (this.mt[i - 1] >>> 30);
|
1607 | this.mt[i] = (this.mt[i] ^ (((((s & 0xffff0000) >>> 16) * 1566083941) << 16) + (s & 0x0000ffff) * 1566083941)) - i;
|
1608 | this.mt[i] >>>= 0;
|
1609 | i++;
|
1610 | if (i >= this.N) { this.mt[0] = this.mt[this.N - 1]; i = 1; }
|
1611 | }
|
1612 |
|
1613 | this.mt[0] = 0x80000000;
|
1614 | };
|
1615 |
|
1616 |
|
1617 | MersenneTwister.prototype.genrand_int32 = function () {
|
1618 | var y;
|
1619 | var mag01 = new Array(0x0, this.MATRIX_A);
|
1620 |
|
1621 |
|
1622 | if (this.mti >= this.N) {
|
1623 | var kk;
|
1624 |
|
1625 | if (this.mti === this.N + 1) {
|
1626 | this.init_genrand(5489);
|
1627 | }
|
1628 | for (kk = 0; kk < this.N - this.M; kk++) {
|
1629 | y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK);
|
1630 | this.mt[kk] = this.mt[kk + this.M] ^ (y >>> 1) ^ mag01[y & 0x1];
|
1631 | }
|
1632 | for (;kk < this.N - 1; kk++) {
|
1633 | y = (this.mt[kk]&this.UPPER_MASK)|(this.mt[kk + 1]&this.LOWER_MASK);
|
1634 | this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ (y >>> 1) ^ mag01[y & 0x1];
|
1635 | }
|
1636 | y = (this.mt[this.N - 1]&this.UPPER_MASK)|(this.mt[0]&this.LOWER_MASK);
|
1637 | this.mt[this.N - 1] = this.mt[this.M - 1] ^ (y >>> 1) ^ mag01[y & 0x1];
|
1638 |
|
1639 | this.mti = 0;
|
1640 | }
|
1641 |
|
1642 | y = this.mt[this.mti++];
|
1643 |
|
1644 |
|
1645 | y ^= (y >>> 11);
|
1646 | y ^= (y << 7) & 0x9d2c5680;
|
1647 | y ^= (y << 15) & 0xefc60000;
|
1648 | y ^= (y >>> 18);
|
1649 |
|
1650 | return y >>> 0;
|
1651 | };
|
1652 |
|
1653 |
|
1654 | MersenneTwister.prototype.genrand_int31 = function () {
|
1655 | return (this.genrand_int32() >>> 1);
|
1656 | };
|
1657 |
|
1658 |
|
1659 | MersenneTwister.prototype.genrand_real1 = function () {
|
1660 | return this.genrand_int32() * (1.0 / 4294967295.0);
|
1661 |
|
1662 | };
|
1663 |
|
1664 |
|
1665 | MersenneTwister.prototype.random = function () {
|
1666 | return this.genrand_int32() * (1.0 / 4294967296.0);
|
1667 |
|
1668 | };
|
1669 |
|
1670 |
|
1671 | MersenneTwister.prototype.genrand_real3 = function () {
|
1672 | return (this.genrand_int32() + 0.5) * (1.0 / 4294967296.0);
|
1673 |
|
1674 | };
|
1675 |
|
1676 |
|
1677 | MersenneTwister.prototype.genrand_res53 = function () {
|
1678 | var a = this.genrand_int32()>>>5, b = this.genrand_int32()>>>6;
|
1679 | return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0);
|
1680 | };
|
1681 |
|
1682 |
|
1683 |
|
1684 | if (typeof exports !== 'undefined') {
|
1685 | if (typeof module !== 'undefined' && module.exports) {
|
1686 | exports = module.exports = Chance;
|
1687 | }
|
1688 | exports.Chance = Chance;
|
1689 | }
|
1690 |
|
1691 |
|
1692 | if (typeof define === 'function' && define.amd) {
|
1693 | define([], function () {
|
1694 | return Chance;
|
1695 | });
|
1696 | }
|
1697 |
|
1698 |
|
1699 |
|
1700 | if (typeof window === "object" && typeof window.document === "object") {
|
1701 | window.Chance = Chance;
|
1702 | window.chance = new Chance();
|
1703 | }
|
1704 | })();
|