Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Const ¶
Const returns a source of constant pseudo-random number generator
Example ¶
package main import ( "fmt" randv2 "math/rand/v2" "github.com/itsubaki/neu/math/rand" ) func main() { s := rand.Const() fmt.Printf("%.13f\n", randv2.New(s).Float64()) fmt.Printf("%.13f\n", randv2.New(s).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(2)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(3)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1, 0)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1, 1)).Float64()) fmt.Printf("%.13f\n", randv2.New(rand.Const(1, 2)).Float64()) }
Output: 0.9999275824803 0.8856419373529 0.2384231908739 0.2384231908739 0.2384231908739 0.8269781200925 0.8353847703964 0.2384231908739 0.3402859786606 0.6764556596678
func Read ¶
Example ¶
package main import ( crand "crypto/rand" "fmt" "strings" "github.com/itsubaki/neu/math/rand" ) func main() { reader := crand.Reader defer func() { crand.Reader = reader }() crand.Reader = strings.NewReader("io.Reader stream to be read\n") if _, err := rand.Read(); err != nil { fmt.Println(err) } }
Output: read: unexpected EOF
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.