kpermute

Top-level

Types

Link copied to clipboard
class ArrayIntPermutation(val size: Int, rng: Random) : IntPermutation

Finite in-memory integer permutation backed by an IntArray lookup table.

Link copied to clipboard

Finite in-memory long permutation backed by a LongArray lookup table.

Link copied to clipboard
class FullIntPermutation(rng: Random = Random.Default, rounds: Int = 2, c1: Int = -2048144789, c2: Int = -1028477387) : IntPermutation

Full 32-bit integer permutation over the entire signed Int domain.

Link copied to clipboard
class FullLongPermutation(rng: Random = Random.Default, rounds: Int = 2, c1: Long = -4658895280553007687, c2: Long = -7723592293110705685) : LongPermutation

Full 64-bit integer permutation over the entire signed Long domain.

Link copied to clipboard
class HalfIntPermutation(val size: Int = Int.MAX_VALUE, rng: Random = Random.Default, rounds: Int = 3, const: Int = -1640531535) : IntPermutation

Finite integer permutation using cycle-walking over a 2^k-sized block.

Link copied to clipboard
class HalfLongPermutation(val size: Long = Long.MAX_VALUE, rng: Random = Random.Default, rounds: Int = 3, const: Long = 5955220737039975883) : LongPermutation

Finite long permutation using cycle-walking over a 2^k-sized block.

Link copied to clipboard

Reversible permutation over a 32-bit integer domain.

Link copied to clipboard

Reversible permutation over a 64-bit integer domain.

Link copied to clipboard
class UIntPermutation(val size: Int, rng: Random = Random.Default, rounds: Int = 3, const: UInt) : IntPermutation

Finite permutation over an unsigned 32-bit-style domain encoded as Int.

Link copied to clipboard
class ULongPermutation(val size: Long, rng: Random = Random.Default, rounds: Int = 3, const: ULong) : LongPermutation

Finite permutation over an unsigned 64-bit-style domain encoded as Long.

Functions

Link copied to clipboard
fun intPermutation(size: Int = Int.MAX_VALUE, seed: Long, rounds: Int = 0): IntPermutation

Creates an IntPermutation using a seed-based Random instance.

fun intPermutation(size: Int = Int.MAX_VALUE, rng: Random = Random.Default, rounds: Int = 0): IntPermutation

Creates an IntPermutation for a contiguous integer domain.

fun intPermutation(range: IntRange, seed: Long, rounds: Int = 0): IntPermutation

Creates an IntPermutation for the given inclusive range using a seed-based Random instance.

fun intPermutation(range: IntRange, rng: Random = Random.Default, rounds: Int = 0): IntPermutation

Creates an IntPermutation for values within the given inclusive range.

Link copied to clipboard
fun longPermutation(size: Long = Long.MAX_VALUE, seed: Long, rounds: Int = 0): LongPermutation

Creates a LongPermutation using a seed-based Random instance.

fun longPermutation(size: Long = Long.MAX_VALUE, rng: Random = Random.Default, rounds: Int = 0): LongPermutation

Creates a LongPermutation for a contiguous long domain.

Creates a LongPermutation for the given inclusive range using a seed-based Random instance.

fun longPermutation(range: LongRange, rng: Random = Random.Default, rounds: Int = 0): LongPermutation

Creates a LongPermutation for values within the given inclusive range.

Link copied to clipboard
fun <T> List<T>.permuted(perm: IntPermutation = intPermutation(size)): List<T>

Returns a new list whose elements are permuted by perm. The original list is not modified.

Link copied to clipboard

Returns a view of this permutation that operates on range instead of [0, size). Only valid for finite domains where range.count() == size.

Link copied to clipboard

Applies the inverse of perm as a view, restoring the original order.