Interface SkippingRandomness

All Superinterfaces:
RandomnessSource, Serializable
All Known Implementing Classes:
LightRNG, MoonwalkRNG, PermutedRNG, PulleyRNG, TangleRNG, ThrustAltRNG

public interface SkippingRandomness
extends RandomnessSource
A simple interface for RandomnessSources that have the additional capability to skip forward or backward in their generated number stream. Created by Tommy Ettinger on 9/15/2015.
  • Method Summary

    Modifier and Type Method Description
    long skip​(long advance)
    Advances or rolls back the SkippingRandomness' state without actually generating each number.

    Methods inherited from interface squidpony.squidmath.RandomnessSource

    copy, next, nextLong
  • Method Details

    • skip

      long skip​(long advance)
      Advances or rolls back the SkippingRandomness' state without actually generating each number. Skips forward or backward a number of steps specified by advance, where a step is equal to one call to RandomnessSource.nextLong(), and returns the random number produced at that step. Negative numbers can be used to step backward, or 0 can be given to get the most-recently-generated long from RandomnessSource.nextLong().
      Parameters:
      advance - Number of future generations to skip over; can be negative to backtrack, 0 gets the most-recently-generated number
      Returns:
      the random long generated after skipping forward or backwards by advance numbers