MCPcopy Create free account
hub / github.com/ACM-VIT/conclave / randomName

Function randomName

scripts/loadtest/loadtest.mjs:77–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75const pick = (arr) => arr[Math.floor(Math.random() * arr.length)];
76
77const randomName = () => {
78 const first = pick(FIRST_NAMES);
79 const last = pick(LAST_NAMES);
80 const roll = Math.random();
81
82 if (roll < 0.5) return `${first} ${last}`;
83 if (roll < 0.68) return first;
84 if (roll < 0.8) return `${first} ${pick(INITIALS)}. ${last}`;
85 if (roll < 0.9) return `${first} ${last[0]}.`;
86 if (roll < 0.96) return `${first} ${pick(LAST_NAMES)} ${last}`;
87 return `${first}-${pick(FIRST_NAMES)} ${last}`;
88};
89
90const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
91

Callers 1

spawnParticipantFunction · 0.85

Calls 1

pickFunction · 0.70

Tested by

no test coverage detected