struct Source
XuAPI
pub struct Source {
pub state int
}Purpose
Structure encapsulating state.
Public fields
stateint- field (int)
#math/randSource instances. No global source. xorshift64*; intn uses rejection sampling.
struct Sourcepub struct Source {
pub state int
}Structure encapsulating state.
state intnew_sourcepub fn new_source(seed int) SourceConstruct source.
seed intSource — a value of this type
($&Source) seedpub fn (s $&Source) seed(seed int)Execute seed on $&Source.
s $&SourceSource instance used by this call (exclusive borrow).seed intThis call does not return a value.
($&Source) int63pub fn (s $&Source) int63() intExecute int63 on $&Source.
s $&SourceSource instance used by this call (exclusive borrow).int — a value of this type
($&Source) intnpub fn (s $&Source) intn(n int) intExecute intn on $&Source.
s $&SourceSource instance used by this call (exclusive borrow).n intint — a value of this type
($&Source) float64pub fn (s $&Source) float64() f64Execute float64 on $&Source.
s $&SourceSource instance used by this call (exclusive borrow).f64 — a value of this type
($&Source) int31pub fn (s $&Source) int31() intExecute int31 on $&Source.
s $&SourceSource instance used by this call (exclusive borrow).int — a value of this type
($&Source) permpub fn (s $&Source) perm(n int) []intOperation on $&Source: permutation.
s $&SourceSource instance used by this call (exclusive borrow).n int[]int — slice result
($&Source) shufflepub fn (s $&Source) shuffle(a $&[]int)Operation on $&Source: shuffle.
s $&SourceSource instance used by this call (exclusive borrow).a $&[]intThis call does not return a value.