mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Remove unused utils * Remove unneeded randomness from tests * Remove more unused functions * Remove unused protobuf structures * Fix small errors
17 lines
285 B
Go
17 lines
285 B
Go
package random
|
|
|
|
import (
|
|
"crypto/rand"
|
|
"encoding/binary"
|
|
)
|
|
|
|
// Uint64 returns a cryptographically random uint64 value.
|
|
func Uint64() (uint64, error) {
|
|
var buf [8]byte
|
|
_, err := rand.Read(buf[:])
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return binary.LittleEndian.Uint64(buf[:]), nil
|
|
}
|