Skip to content

Instantly share code, notes, and snippets.

@FlameWolf
Last active October 17, 2023 05:52
Show Gist options
  • Save FlameWolf/5afd912d4908c2c84d1865ae2befe290 to your computer and use it in GitHub Desktop.
Save FlameWolf/5afd912d4908c2c84d1865ae2befe290 to your computer and use it in GitHub Desktop.
Generate random ID string V2
const getRandomIdString = (steps = 4) => {
let seed = "";
for (let i = 0; i < steps; i++) {
seed += Math.random().toString().substring(2);
}
return BigInt(seed).toString(36).toUpperCase();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment