generator: Fix initial payload generation #43

Merged
fyrchik merged 1 commit from fyrchik/xk6-frostfs:fix-generator into master 2023-03-24 07:29:32 +00:00

View file

@ -40,11 +40,15 @@ func NewGenerator(vu modules.VU, size int) Generator {
if size <= 0 { if size <= 0 {
panic("size should be positive") panic("size should be positive")
} }
r := rand.New(rand.NewSource(time.Now().UnixNano()))
buf := make([]byte, size+TailSize)
r.Read(buf)
return Generator{ return Generator{
vu: vu, vu: vu,
size: size, size: size,
rand: rand.New(rand.NewSource(time.Now().UnixNano())), rand: r,
buf: make([]byte, size+TailSize), buf: buf,
} }
} }