Skip to content

Instantly share code, notes, and snippets.

@PaulRBerg
Created September 10, 2021 15:43
Show Gist options
  • Save PaulRBerg/043ac2b2d367815d72293c6687a838b8 to your computer and use it in GitHub Desktop.
Save PaulRBerg/043ac2b2d367815d72293c6687a838b8 to your computer and use it in GitHub Desktop.
Random bytes32 generator written in TypeScript
export function getRandomBytes32(): string {
const length: number = 64;
const array: number[] = [...Array(length)];
const number: string = array.map(() => Math.floor(Math.random() * 16).toString(16)).join("");
return "0x" + number;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment