ixfx
    Preparing search index...

    Function lfsrSource

    • Creates a linear feedback shift register (LFSR). Useful for creating deterministic, pseudo-random numbers.

      Uses 0 (inclusive)...1 (exclusive) scale like Math.random();

      // Get a function to produce sclar (0..1) values:
      const l = lfsrSource();

      // Produce a value
      l(); // 0..1 value

      By default, lfsrSource uses a fixed seed, so each time it creates the same series of random numbers.

      Custom seed

      const l = lfsrSource({ seed: 0b10111101 });
      

      The algorithm natively produces integer values which are scaled to 0..1 range. If you want integer results:

      const l = lfsrSource({ output: `integer` });
      

      Note: not very high-resolution.

      Parameters

      Returns RandomSource