Documentation ¶
Overview ¶
Package intperm implements a simple permutation for 64-bit ints. This file also includes a simple XORShift-based PRNG for expanding the seed. Example code from http://www.jstatsoft.org/v08/i14/paper (public domain).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Permutation ¶
type Permutation []uint64
A Permutation is a reversible, pseudo-random mapping of 64-bit unsigned ints.
func New ¶
func New(seed uint64) Permutation
New creates a new Permutation. The argument can be any random number.
func (Permutation) MapFrom ¶
func (p Permutation) MapFrom(x uint64) uint64
MapFrom is the reverse of MapTo. In other words, p.MapFrom(p.MapTo(x)) == x.
func (Permutation) MapTo ¶
func (p Permutation) MapTo(x uint64) uint64
MapTo a number to another random one.
Click to show internal directories.
Click to hide internal directories.