Comment

Comment by some1else

Here's one I use for cryptographic purposes:

  let invocations = 0;

  export function rand3000() {
    invocations += 1;

    const timestamp = new Date().getTime() + invocations * 1000;
    const masked = (timestamp ^ (timestamp >> 8)) & 0xFF;
    const result = masked / 255;

    return result;
  }
parent some1else 1 year ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton