XU XUv0.16.0

#math/rand

import: #math/rand

counts: 1 functions, 7 methods, 1 types, 0 constants, 0 method sets

Source instances. No global source. xorshift64*; intn uses rejection sampling.

struct Source

XuAPI
pub struct Source {
    pub state int
}

Purpose

Structure encapsulating state.

Public fields

state int
field (int)

new_source

XuAPI
pub fn new_source(seed int) Source

Purpose

Construct source.

Parameters

seed int
random seed (int)

Returns

Source — a value of this type

($&Source) seed

XuAPI
pub fn (s $&Source) seed(seed int)

Purpose

Execute seed on $&Source.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).
seed int
random seed (int)

Returns

This call does not return a value.

($&Source) int63

XuAPI
pub fn (s $&Source) int63() int

Purpose

Execute int63 on $&Source.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Source) intn

XuAPI
pub fn (s $&Source) intn(n int) int

Purpose

Execute intn on $&Source.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).
n int
count, length, or limit (int)

Returns

int — a value of this type

($&Source) float64

XuAPI
pub fn (s $&Source) float64() f64

Purpose

Execute float64 on $&Source.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).

Returns

f64 — a value of this type

($&Source) int31

XuAPI
pub fn (s $&Source) int31() int

Purpose

Execute int31 on $&Source.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).

Returns

int — a value of this type

($&Source) perm

XuAPI
pub fn (s $&Source) perm(n int) []int

Purpose

Operation on $&Source: permutation.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).
n int
count, length, or limit (int)

Returns

[]int — slice result

($&Source) shuffle

XuAPI
pub fn (s $&Source) shuffle(a $&[]int)

Purpose

Operation on $&Source: shuffle.

Parameters

s $&Source
The Source instance used by this call (exclusive borrow).
a $&[]int
slice to operate on (exclusive borrow; may modify the original; type $&[]int)

Returns

This call does not return a value.