Package-level declarations

Helper functions such as pickRandomly/takeRandomly as well as helper functions for Sequence.

Types

Link copied to clipboard
typealias BigInt = BigInteger

Functions

Link copied to clipboard

Creates a Random based on the VariistConfig behind ordered.

Link copied to clipboard
fun Random.nextBigInt(toExclusive: BigInt): BigInt

Generates a random BigInt uniformly distributed between 0 (inclusive) and the specified toExclusive bound.

fun Random.nextBigInt(from: BigInt, toExclusive: BigInt): BigInt

Generates a random BigInt uniformly distributed between from (inclusive) and the specified toExclusive bound.

Link copied to clipboard

Picks randomly one element from this Collection based on the configured VariistConfig.seed.

fun <T> SemiOrderedArgsGenerator<T>.pickOneRandomly(seedOffset: Int = 0): T

Picks randomly one element from this SemiOrderedArgsGenerator based on the configured VariistConfig.seed.

Link copied to clipboard

Returns an infinite Sequence of Unit.

fun <T> repeatForever(constant: T): Sequence<T>

Returns an infinite Sequence backed by the given constant.

fun <T> repeatForever(array: Array<T>, offset: Int = 0): Sequence<T>

Returns an infinite Sequence backed by the given array, starting at the given offset.

fun <T> repeatForever(list: List<T>, offset: Int = 0): Sequence<T>

Returns an infinite Sequence backed by the given list, starting at the given offset.

Link copied to clipboard
fun seedToOffset(seed: Int): Int

Makes sure the given seed is positive, so that it can be used as offset in an SemiOrderedArgsGenerator.

Link copied to clipboard
fun <T> Array<T>.takeRandomly(amount: Int): List<T>

Takes the given amount of elements from this Array (likewise Array.take) but in a random way based on the configured VariistConfig.seed.

fun <T> Iterable<T>.takeRandomly(amount: Int): List<T>

Takes the given amount of elements from this Iterable (likewise Iterable.take) but in a random way based on the configured VariistConfig.seed.

fun <T> Sequence<T>.takeRandomly(amount: Int): Sequence<T>

Takes the given amount of elements from this Sequence (likewise Sequence.take) but in a random way based on the configured VariistConfig.seed.

fun <T> SemiOrderedArgsGenerator<T>.takeRandomly(amount: Int, seedOffset: Int = 0): List<T>

Takes randomly the given amount of elements from this SemiOrderedArgsGenerator.

Link copied to clipboard
inline fun Int.toBigInt(): <Error class: unknown class>

Converts this Int to a BigInt.

inline fun Long.toBigInt(): <Error class: unknown class>

Converts this Long to a BigInt.