mirror of
https://github.com/luxfi/bft.git
synced 2026-10-30 17:01:54 +00:00
* move more to common * more moves * move random --------- Co-authored-by: yacovm <[email protected]>
14 lines
266 B
Go
14 lines
266 B
Go
package common
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"math/rand/v2"
|
|
)
|
|
|
|
func NewRandomSourceFromSeed(seed int64) *rand.Rand {
|
|
var seedBytes [32]byte
|
|
binary.LittleEndian.PutUint64(seedBytes[:8], uint64(seed))
|
|
chacha := rand.NewChaCha8(seedBytes)
|
|
return rand.New(chacha)
|
|
}
|