Re: [PATCH 1/6] maintenance: add get_random_minute()
From: Derrick Stolee <hidden>
Date: 2023-08-09 12:17:48
On 8/8/2023 4:04 PM, Taylor Blau wrote:
On Tue, Aug 08, 2023 at 01:28:50PM -0400, Derrick Stolee wrote:
quoted
I see you're moving ahead with removing the srand() from the lockfile code,
That thread may have progressed a little since you last looked at it.
I think this part of my summary is still correct.
quoted
so I'll focus on creating a `git_rand()` that centralizes the use of srand(), but won't touch the code in the lockfile so your patch applies independently.
Instead of using srand() and rand() (which would make sense to wrap with git_rand() as you propose), we can simplify our lives by using a CSPRNG, which only gets initialized once, as is already the case with csprng_bytes().
So the idea is to use csprng_bytes() everywhere instead of srand()/rand(). I can adjust my local patch to still create git_rand(), but base it on csprng_bytes() and not collide with your patch. Mimicking rand()'s behavior is a simpler interface to consume. Thanks, -Stolee