Debian Codegraph @

vendor/github.com/xyproto/gfx/rand.go

raw
1 //go:build !tinygo
2 // +build !tinygo
3
4 package gfx
5
6 import "math/rand"
7
8 // RandSeed uses the provided seed value to initialize the default Source to a
9 // deterministic state. If Seed is not called, the generator behaves as
10 // if seeded by Seed(1). Seed values that have the same remainder when
11 // divided by 2^31-1 generate the same pseudo-random sequence.
12 // RandSeed, unlike the Rand.Seed method, is safe for concurrent use.
13 func RandSeed(seed int64) {
14 rand.Seed(seed)
15 }
16
17 // RandIntn returns, as an int, a non-negative pseudo-random number in [0,n)
18 // from the default Source.
19 // It panics if n <= 0.
20 func RandIntn(n int) int { return rand.Intn(n) }
21
22 // RandFloat64 returns, as a float64, a pseudo-random number in [0.0,1.0)
23 // from the default Source.
24 func RandFloat64() float64 { return rand.Float64() }