mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-02 03:10:42 -05:00
26 lines
468 B
Go
26 lines
468 B
Go
package test
|
|
|
|
import "math/rand"
|
|
|
|
const (
|
|
// ShouldNeverHappen is only seen when the impossible happens.
|
|
ShouldNeverHappen = "http://www.nooooooooooooooo.com"
|
|
)
|
|
|
|
// RandomData returns a slice of a given size filled with random data
|
|
func RandomData(size int) []byte {
|
|
randBytes := make([]byte, size)
|
|
filled := 0
|
|
for filled < size {
|
|
n, err := rand.Read(randBytes[filled:])
|
|
|
|
if err != nil {
|
|
panic(ShouldNeverHappen)
|
|
}
|
|
|
|
filled += n
|
|
}
|
|
|
|
return randBytes
|
|
}
|