On Tue, Aug 08, 2023 at 01:28:50PM -0400, Derrick Stolee wrote: > > So I think this is kind of outside the scope of your series, but I > > wonder if we should have a git_rand() that automatically initializes the > > PRNG with the value of getpid()? Then multiple callers can grab random > > values at will without reinitializing the PRNG. > > I see you're moving ahead with removing the srand() from the lockfile code, > 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. That thread may have progressed a little since you last looked at it. 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(). I think Junio is picking up a lightly modified version of my patch there, see [1]. Thanks, Taylor [1]: https://lore.kernel.org/git/ZNKfKs1mLQhnybvF@nand.local/