mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Ensuring get_random_double returns at least some decimal places more often than not.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13238 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -305,16 +305,13 @@ get_random_gint64(void)
|
||||
double
|
||||
get_random_double(void)
|
||||
{
|
||||
union
|
||||
{
|
||||
double d;
|
||||
gint64 i;
|
||||
} ret;
|
||||
|
||||
double d;
|
||||
guint i;
|
||||
|
||||
ret.i = get_random_gint64();
|
||||
|
||||
return ret.d;
|
||||
i = (guint)get_random_int_in_range(8,13);
|
||||
/* using 0.9 and 7 increases chances of getting lots of decimals */
|
||||
d = ((double)get_random_int_in_range(8,999999) * i * 0.9 / 7);
|
||||
return d;
|
||||
}
|
||||
|
||||
const char*
|
||||
|
Reference in New Issue
Block a user