Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 447 Bytes

File metadata and controls

22 lines (16 loc) · 447 Bytes

Random

  • Generate fake IP
const generateIP = (): string =>
  [...new Array(4)]
    .map((_, index) => Math.floor(Math.random() * 255) + Number(Boolean(index)))
    .join('.');
  • Generate random hex
const randomHex = () => `#${Math.floor(Math.random() * 0xffffff).toString(16).padEnd(6, "0")}`;
  • Generate a random string
const randomString = () => Math.random().toString(36).slice(2);