File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ This document outlines major changes between releases.
1010
1111### Changed
1212- Go 1.21+ is required to build now (#61 )
13+ - Replaced ` math/rand.Read ` with ` math/rand/v2.ChaCha8.Read `
1314
1415## [ 0.1.2] - 2024-03-11
1516
Original file line number Diff line number Diff line change @@ -2,8 +2,10 @@ package datagen
22
33import (
44 "crypto/sha256"
5+ "encoding/binary"
56 "encoding/hex"
6- "math/rand"
7+ "math/rand/v2"
8+ "time"
79
810 "github.com/dop251/goja"
911 "go.k6.io/k6/js/modules"
@@ -58,8 +60,13 @@ func (g *Generator) nextSlice() []byte {
5860 if g .buf == nil {
5961 // Allocate buffer with extra tail for sliding and populate it with random bytes
6062 g .buf = make ([]byte , g .size + TailSize )
63+
64+ var seed [32 ]byte
65+ binary .LittleEndian .PutUint64 (seed [:], uint64 (time .Now ().UnixNano ()))
66+ chaCha8 := rand .NewChaCha8 (seed )
67+
6168 //nolint:staticcheck
62- rand .Read (g .buf ) // Per docs, err is always nil here
69+ _ , _ = chaCha8 .Read (g .buf ) // Per docs, err is always nil here
6370 }
6471
6572 result := g .buf [g .offset : g .offset + g .size ]
You can’t perform that action at this time.
0 commit comments