Debian Codegraph @

random/source.go

raw
1 package random
2
3 import (
4 "math"
5 "math/rand"
6 )
7
8 type source struct{}
9
10 // Assert that source implements rand.Source64.
11 var _ rand.Source64 = source{}
12
13 func (source) Seed(int64) {}
14
15 func (source) Int63() int64 {
16 return int64(GetRandom() & (math.MaxUint64 >> 1))
17 }
18
19 func (source) Uint64() uint64 {
20 return GetRandom()
21 }
22
23 // Source initialises a source of pseudo-random data.
24 //
25 // Use this function to create a [math/rand.Rand] which is steered by the Antithesis platform.
26 //
27 // The returned source implements [math/rand.Source64].
28 func Source() rand.Source {
29 return source{}
30 }