MCPcopy Create free account
hub / github.com/Lundalogik/lime-elements / legacyCreateRandomString

Function legacyCreateRandomString

src/util/random-string.ts:12–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10};
11
12function legacyCreateRandomString() {
13 const USE_HEX = 36;
14 const SKIP_LEADING_ZERODOT = 2;
15 const ASCII_A = 97;
16 const NUMBER_OF_LETTERS = 26;
17
18 /* eslint-disable sonarjs/pseudo-random */
19 return (
20 // eslint-disable-next-line unicorn/prefer-code-point
21 String.fromCharCode(
22 ASCII_A + Math.floor(Math.random() * NUMBER_OF_LETTERS)
23 ) +
24 Math.random()
25 .toString(USE_HEX)
26 .slice(Math.max(0, SKIP_LEADING_ZERODOT)) +
27 Math.random().toString(USE_HEX).slice(Math.max(0, SKIP_LEADING_ZERODOT))
28 );
29 /* eslint-enable sonarjs/pseudo-random */
30}

Callers 1

createRandomStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected