struct Source
XuAPI
pub struct Source {
pub state int
}用途
公开结构体 `Source`。
参数
stateint- 字段(int)
API
#math/randSource 实例。无全局源。xorshift64*,intn 拒绝采样。
struct Sourcepub struct Source {
pub state int
}公开结构体 `Source`。
state intnew_sourcepub fn new_source(seed int) Source构造 source。
seed intSource — 该类型的值
(&mut Source) seedpub fn (s &mut Source) seed(seed int)`&mut Source` 上的方法:种子。
s &mut Sourceseed int(&mut Source) int63pub fn (s &mut Source) int63() int在 `&mut Source` 上调用 `int63`。
s &mut Sourceint — 该类型的值
(&mut Source) intnpub fn (s &mut Source) intn(n int) int在 `&mut Source` 上调用 `intn`。
s &mut Sourcen intint — 该类型的值
(&mut Source) float64pub fn (s &mut Source) float64() f64在 `&mut Source` 上调用 `float64`。
s &mut Sourcef64 — 该类型的值
(&mut Source) int31pub fn (s &mut Source) int31() int在 `&mut Source` 上调用 `int31`。
s &mut Sourceint — 该类型的值
(&mut Source) permpub fn (s &mut Source) perm(n int) []int`&mut Source` 上的方法:排列。
s &mut Sourcen int[]int — 切片结果
(&mut Source) shufflepub fn (s &mut Source) shuffle(a &mut []int)`&mut Source` 上的方法:打乱。
s &mut Sourcea &mut []int