001package squidpony.squidmath;
002
003/**
004 * A simple interface for RandomnessSources that have the additional capability to skip forward or backward in their
005 * generated number stream.
006 * Created by Tommy Ettinger on 9/15/2015.
007 */
008public interface SkippingRandomness extends RandomnessSource {
009    /**
010     * Advances or rolls back the SkippingRandomness' state without actually generating each number. Skips forward
011     * or backward a number of steps specified by advance, where a step is equal to one call to {@link #nextLong()},
012     * and returns the random number produced at that step. Negative numbers can be used to step backward, or 0 can be
013     * given to get the most-recently-generated long from {@link #nextLong()}.
014     *
015     * @param advance Number of future generations to skip over; can be negative to backtrack, 0 gets the most-recently-generated number
016     * @return the random long generated after skipping forward or backwards by {@code advance} numbers
017     */
018    long skip(long advance);
019}