kpermute

FullLongPermutation

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

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

Uses an invertible 64-bit hash built from XOR, shifts, and odd multipliers with per-round keys. No tables are stored; encode and decode apply forward and inverse rounds respectively.

Parameters

rng

Source of randomness for generating round keys.

rounds

Number of mixing rounds; more rounds increase dispersion.

c1

First odd multiplicative constant used in the mixing steps.

c2

Second odd multiplicative constant used in the mixing steps.

Constructors

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

Properties

Link copied to clipboard
open override val size: Long

Domain size of the permutation.

Functions

Link copied to clipboard
open fun decode(encoded: Long): Long

Decodes a previously encoded long back to its original value.

Link copied to clipboard
open override fun decodeUnchecked(encoded: Long): Long

Decodes a previously encoded value without range checks.

Link copied to clipboard
open fun encode(value: Long): Long

Encodes a long in the permutation domain into its permuted value.

Link copied to clipboard
open override fun encodeUnchecked(value: Long): Long

Encodes a value without range checks.

Link copied to clipboard
open override fun iterator(offset: Long): LongIterator

Returns an iterator over encode(i) for indices in [offset, size).

open operator override fun iterator(): LongIterator

Returns an iterator over encode(i) for all i in [0, size) for finite domains, or over the full 64-bit space when size == -1L.

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
open override fun toString(): String

FullLongPermutation

constructor(rng: Random = Random.Default, rounds: Int = 2, c1: Long = -4658895280553007687, c2: Long = -7723592293110705685)(source)

Parameters

rng

Source of randomness for generating round keys.

rounds

Number of mixing rounds; more rounds increase dispersion.

c1

First odd multiplicative constant used in the mixing steps.

c2

Second odd multiplicative constant used in the mixing steps.

decodeUnchecked

open override fun decodeUnchecked(encoded: Long): Long(source)

Decodes a previously encoded value without range checks.

encodeUnchecked

open override fun encodeUnchecked(value: Long): Long(source)

Encodes a value without range checks.

iterator

open override fun iterator(offset: Long): LongIterator(source)

Returns an iterator over encode(i) for indices in [offset, size).

For finite domains, offset is an index in 0..size. For full-domain implementations, semantics are defined by the implementation.

size

open override val size: Long(source)

Domain size of the permutation.

  • size >= 0L: finite domain [0, size).

  • size == -1L: full signed 64-bit domain.

toString

open override fun toString(): String(source)