rand_double_range


Description:

[ Version ( since = "2.16" ) ]
public double rand_double_range (double begin, double end)

Get a reproducible random floating pointer number out of a specified range, see rand_int for details on test case random numbers.

Example: Reproducible random constricted doubles:

public static int main (string[] args) {
Test.init (ref args);

// Don't do this at home kids!
double rand1 = 0;
double rand2 = 0;
double rand3 = 0;

Test.add_data_func ("/valadoc/driver-0.14.x", () => {
// --seed R02S855b50e66c1a59011b2cd8f4c28c9996 forces our number generator
// to generate the same sequence of numbers for each test/run:
rand1 = Test.rand_double_range (double.MIN, double.MAX);
rand2 = Test.rand_double_range (double.MIN, double.MAX);
rand3 = Test.rand_double_range (double.MIN, double.MAX);
});

Test.add_data_func ("/valadoc/driver-0.16.x", () => {
assert (Test.rand_double_range (double.MIN, double.MAX) == rand1);
assert (Test.rand_double_range (double.MIN, double.MAX) == rand2);
assert (Test.rand_double_range (double.MIN, double.MAX) == rand3);
});

Test.run ();
return 0;
}

valac --pkg glib-2.0 GLib.Test.rand_double_range.vala

./GLib.Test.rand_double_range --verbose --seed R02S855b50e66c1a59011b2cd8f4c28c9996

Parameters:

range_end

the minimum value not returned by this function

range_start

the minimum value returned by this function

Returns:

a number with range_start <= number < range_end.


Namespace: GLib.Test
Package: glib-2.0