MCPcopy Index your code
hub / github.com/RandomAPI/Randomuser.me-Node / random

Function random

api/1.4/api.js:414–436  ·  view source on GitHub ↗
(mode, length)

Source from the content-addressed store, hash-verified

412}
413
414function random(mode, length) {
415 let result = '';
416 let chars;
417
418 if (mode == 1) {
419 chars = 'abcdef1234567890';
420 } else if (mode == 2) {
421 chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
422 } else if (mode == 3) {
423 chars = '0123456789';
424 } else if (mode == 4) {
425 chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
426 } else if (mode == 5) {
427 chars = '23456789';
428 } else if (mode == 6) {
429 chars = 'abcdefghijklmnopqrstuvwxyz';
430 }
431 for (let i = 0; i < length; i++) {
432 result += chars[range(0, chars.length-1)];
433 }
434
435 return result;
436}
437
438function randomItem(arr) {
439 return arr[range(0, arr.length-1)];

Callers 15

generateMethod · 0.70
defaultSeedMethod · 0.70
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
inject.jsFile · 0.50
genSINFunction · 0.50
inject.jsFile · 0.50

Calls 1

rangeFunction · 0.70

Tested by

no test coverage detected