Re: [PATCH 1/6] maintenance: add get_random_minute()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 9, 2023, 18:50 UTC
- Message-ID
- <xmqq7cq4nj7l.fsf@gitster.g>
- In-Reply-To
- <a1e7d730-e220-48ec-8393-2d3538b80163@github.com>
Derrick Stolee <derrickstolee@github.com> writes:
Show 10 quoted lines
>> 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.
I am still ambivalent about wasting entropy for something that srand() would suffice, so git_rand() interface may be an welcome addition anyway, that serves an extra layer of indirection to insulate the callers from the implementation.
Thanks.