common: expose pseudorand_double

This commit is contained in:
Simon Vrouwe
2019-04-16 10:15:21 +03:00
committed by Rusty Russell
parent 77236caa91
commit 06a062f36b
2 changed files with 13 additions and 0 deletions

View File

@@ -44,6 +44,13 @@ uint64_t pseudorand_u64(void)
return isaac64_next_uint64(&isaac64); return isaac64_next_uint64(&isaac64);
} }
double pseudorand_double(void)
{
init_if_needed();
return isaac64_next_double(&isaac64);
}
const struct siphash_seed *siphash_seed(void) const struct siphash_seed *siphash_seed(void)
{ {
init_if_needed(); init_if_needed();

View File

@@ -13,6 +13,12 @@ uint64_t pseudorand(uint64_t max);
*/ */
uint64_t pseudorand_u64(void); uint64_t pseudorand_u64(void);
/**
* pseudorand - pseudo (guessable!) random number between 0 (inclusive) and 1
* (exclusive).
*/
double pseudorand_double(void);
/** /**
* Get the siphash seed for hash tables. * Get the siphash seed for hash tables.
*/ */