From 9ee40c767c46d820ddf89c3cb894074d7cde479b Mon Sep 17 00:00:00 2001 From: Cole Eason Date: Tue, 25 Jun 2024 22:09:59 +0000 Subject: [PATCH] Make SRandom not require a reference --- libstuff/SRandom.cpp | 6 +++--- libstuff/SRandom.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libstuff/SRandom.cpp b/libstuff/SRandom.cpp index b6900dac6..d864589a8 100644 --- a/libstuff/SRandom.cpp +++ b/libstuff/SRandom.cpp @@ -18,13 +18,13 @@ uint64_t SRandom::rand64() { return _distribution64(_generator); } -string SRandom::randStr(uint& length) { +string SRandom::randStr(uint length) { string str = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; string newstr; int pos; - while(newstr.size() != length) { + while (newstr.size() != length) { pos = (rand64() % (str.size() - 1)); - newstr += str.substr(pos,1); + newstr += str.substr(pos, 1); } return newstr; } diff --git a/libstuff/SRandom.h b/libstuff/SRandom.h index a718a04cd..9058206ea 100644 --- a/libstuff/SRandom.h +++ b/libstuff/SRandom.h @@ -10,7 +10,7 @@ class SRandom { public: static uint64_t rand64(); static uint64_t limitedRand64(uint64_t min, uint64_t max); - static string randStr(uint& length); + static string randStr(uint length); private: static mt19937_64 _generator;