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

Function random

api/1.3/api.js:406–424  ·  view source on GitHub ↗
(mode, length)

Source from the content-addressed store, hash-verified

404}
405
406function random(mode, length) {
407 let result = '';
408 let chars;
409
410 if (mode == 1) {
411 chars = 'abcdef1234567890';
412 } else if (mode == 2) {
413 chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
414 } else if (mode == 3) {
415 chars = '0123456789';
416 } else if (mode == 4) {
417 chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
418 }
419 for (let i = 0; i < length; i++) {
420 result += chars[range(0, chars.length-1)];
421 }
422
423 return result;
424}
425
426function randomItem(arr) {
427 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
inject.jsFile · 0.50
inject.jsFile · 0.50

Calls 1

rangeFunction · 0.70

Tested by

no test coverage detected