struct Source
XuAPI
pub struct Source {
pub state int
}用途
承载 state 等属性的结构体。
公开字段
stateint- 字段(int)
#math/randSource 实例。无全局源。xorshift64*,intn 拒绝采样。
struct Sourcepub struct Source {
pub state int
}承载 state 等属性的结构体。
state intnew_sourcepub fn new_source(seed int) Source构造 source。
seed intSource — 该类型的值
($&Source) seedpub fn (s $&Source) seed(seed int)$&Source 上的操作:种子。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。seed int不返回值。
($&Source) int63pub fn (s $&Source) int63() int在 $&Source 上执行 int63 操作。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值
($&Source) intnpub fn (s $&Source) intn(n int) int在 $&Source 上执行 intn 操作。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。n intint — 该类型的值
($&Source) float64pub fn (s $&Source) float64() f64在 $&Source 上执行 float64 操作。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。f64 — 该类型的值
($&Source) int31pub fn (s $&Source) int31() int在 $&Source 上执行 int31 操作。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。int — 该类型的值
($&Source) permpub fn (s $&Source) perm(n int) []int$&Source 上的操作:排列。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。n int[]int — 切片结果
($&Source) shufflepub fn (s $&Source) shuffle(a $&[]int)$&Source 上的操作:打乱。
s $&SourceSource 实例;以独占借用传入,方法可修改它,调用方仍持有实例。a $&[]int不返回值。