[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [libvirt] PATCH: 21/25: Use random_r for random numbers
- From: Jim Meyering <jim meyering net>
- To: "Daniel P. Berrange" <berrange redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [libvirt] PATCH: 21/25: Use random_r for random numbers
- Date: Tue, 20 Jan 2009 12:22:46 +0100
"Daniel P. Berrange" <berrange redhat com> wrote:
> Now that gnulib's rand module is imported, we have a decent
> quality random number generator that's portable. We don't
> want to mess with the apps state, so in virInitialize() we
> explicitly initialize our own private random nubmer generator
> state with virRandomInitialize().
>
> The util.h file gains a convenience macro, since random_r()
> is horrible to call and we need to protect our global state
>
> int virRandom(int max)
...
> +int virRandomInitialize(void)
This all looks good and correct.
Only one suggestion: consider exposing the seed-setting
functionality by moving it up a level:
int virRandomInitialize(int seed)
in case we ever want reproducibly random MAC addresses and UUIDs.
This might be useful for testing.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]