random_permutation: Generate a lazy non-repeating random number generator

Description Usage Arguments Value

View source: R/random_permutation.R

Description

Generates a function that provides lazy number generation from a random permutation of integers 1 to n without repetition. The numbers are generated using the Fisher-Yates algorithm and run length encoding (RLE) is used to keep memory use for the storage of used/available numbers minimal.

Usage

1

Arguments

n

Upper limit for random numbers (inclusive)

Value

A function f(m) that returns m random numbers from the random permutation of integers 1 to n without repetition,. If all available numbers 1 to n have been returned but more are requested, the function throws an error.


Teebusch/noah documentation built on Jan. 24, 2021, 9:40 p.m.