MCPcopy
hub / github.com/Peppermint-Lab/peppermint / generateRandomCode

Function generateRandomCode

apps/api/src/controllers/auth.ts:207–211  ·  view source on GitHub ↗
(length = 6)

Source from the content-addressed store, hash-verified

205 }
206
207 function generateRandomCode(length = 6) {
208 const min = Math.pow(10, length - 1); // Minimum number for the given length
209 const max = Math.pow(10, length) - 1; // Maximum number for the given length
210 return Math.floor(Math.random() * (max - min + 1)) + min;
211 }
212
213 const code = generateRandomCode();
214

Callers 1

authRoutesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected