MCPcopy Create free account
hub / github.com/bewcloud/bewcloud / generateRandomCode

Function generateRandomCode

public/ts/utils/misc.ts:59–65  ·  view source on GitHub ↗
(length = 6)

Source from the content-addressed store, hash-verified

57}
58
59export function generateRandomCode(length = 6) {
60 const getRandomDigit = () => Math.floor(Math.random() * (10)); // 0-9
61
62 const codeDigits = Array.from({ length }).map(getRandomDigit);
63
64 return codeDigits.join('');
65}
66
67/** This generates a random string, including unicode characters. */
68export function generateRandomString(length = 10) {

Callers 3

misc_test.tsFile · 0.90
getSignInUrlMethod · 0.90
createMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected