[#43] generator: Fix initial payload generation

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2023-03-23 18:13:35 +03:00 committed by Gitea
parent 220a822377
commit cea265a3f8

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,
} }
} }