From 582a0a1c93867f037d2cb281dcbef3bd7da00dd2 Mon Sep 17 00:00:00 2001
From: "Richard T. Carback III" <rick.carback@gmail.com>
Date: Thu, 14 Apr 2022 18:11:16 +0000
Subject: [PATCH] Use the fastRNG instead of rand.Reader

---
 cmix/follow.go | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/cmix/follow.go b/cmix/follow.go
index 5bafb3718..b3a5bc662 100644
--- a/cmix/follow.go
+++ b/cmix/follow.go
@@ -24,9 +24,11 @@ package cmix
 
 import (
 	"bytes"
-	"crypto/rand"
 	"encoding/binary"
 	"fmt"
+	"sync/atomic"
+	"time"
+
 	jww "github.com/spf13/jwalterweatherman"
 	"gitlab.com/elixxir/client/cmix/identity/receptionID/store"
 	"gitlab.com/elixxir/client/stoppable"
@@ -37,8 +39,6 @@ import (
 	"gitlab.com/xx_network/crypto/csprng"
 	"gitlab.com/xx_network/primitives/id"
 	"gitlab.com/xx_network/primitives/netTime"
-	"sync/atomic"
-	"time"
 )
 
 const (
@@ -424,10 +424,12 @@ func (c *client) follow(report ClientErrorReport, rng csprng.Source,
 
 // getFakeEarliestRound generates a random earliest round for a fake identity.
 func (c *client) getFakeEarliestRound() id.Round {
-	b, err := csprng.Generate(8, rand.Reader)
+	rng := c.rng.GetStream()
+	b, err := csprng.Generate(8, rng)
 	if err != nil {
-		jww.FATAL.Panicf("Could not get random number: %+v", err)
+		jww.FATAL.Panicf("Could not get random number: %v", err)
 	}
+	rng.Close()
 
 	rangeVal := binary.LittleEndian.Uint64(b) % 800
 
-- 
GitLab