Full cycle

In a pseudorandom number generator (PRNG), a full cycle or full period is the behavior of a PRNG over its set of valid states.

Uses your system voice; voice and rate in settings.

≈ 2 min read

Cite, export and learn8 citation formats · 8 exports · lesson and quiz

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

In a pseudorandom number generator (PRNG), a full cycle or full period is the behavior of a PRNG over its set of valid states. In particular, a PRNG is said to have a full cycle if, for any valid seed state, the PRNG traverses every valid state before returning to the seed state, i.e., the period is equal to the cardinality of the state space.

The restrictions on the parameters of a PRNG for it to possess a full cycle are known only for certain types of PRNGs, such as linear congruential generators and linear-feedback shift registers. There is no general method to determine whether a PRNG algorithm is full-cycle short of exhausting the state space, which may be exponentially large compared to the size of the algorithm's internal state.

Example 1 (in C/C++)

Given a random number seed that is greater or equal to zero, a total sample size greater than 1, and an increment coprime to the total sample size, a full cycle can be generated with the following logic. Each nonnegative number smaller than the sample size occurs exactly once. unsigned int seed = 0; unsigned int sample_size = 3000; unsigned int generated_number = seed % sample_size; unsigned int increment = 7; for (unsigned int iterator = 0; iterator

Example 1 (in Python)

Generator that goes through a full cycle def cycle(seed: int, sample_size: int, increment: int): nb = seed for i in range(sample_size): nb = (nb + increment) % sample_size yield nb Example values seed = 17 sample_size = 100 increment = 13 Print all the numbers print(list(cycle(seed, sample_size, increment))) Verify that all numbers were generated correctly assert set(cycle(seed, sample_size, increment))

set(range(sample_size))

See also

Linear congruential generator Xorshift

References==

Text derived from https://en.wikipedia.org/w/index.php?oldid=1374394748 under CC BY-SA 4.0; modifications have been made.

Words in each sectionExample 1 (in C/C++)Example 1 (in C/C++)Example 1 (in C/C++): 75 words75Example 1 (in Python)Example 1 (in Python)Example 1 (in Python): 65 words65Linear congruential gen…Linear congruential generator XorshiftLinear congruential generator Xorshift: 22 words22set(range(sample_size))set(range(sample_size))set(range(sample_size)): 2 words2
Words in each section. Measured from the stored article body; sections below the minimum are not plotted.

Provenance

snapshot enwiki-001374394748 · captured 2026-09-11 · ledger · version history

Cite this page as: encyclopegia.org, “Full cycle”, snapshot enwiki-001374394748. https://encyclopegia.org/a/full-cycle

Sources cited in this revision

No external citation was extracted for this revision. That is a statement about the source, not a claim that none exists.