3 const gint32 first_numbers[] =
28 const gint length = sizeof (first_numbers) / sizeof (first_numbers[0]);
34 GRand* rand = g_rand_new_with_seed (first_numbers[0]);
36 for (n = 1; n < length; n++)
37 g_assert (first_numbers[n] == g_rand_int (rand));
39 for (n = 1; n < 100000; n++)
45 i = g_rand_int_range (rand, 8,16);
46 g_assert (i >= 8 && i < 16);
48 i = g_random_int_range (8,16);
49 g_assert (i >= 8 && i < 16);
51 d = g_rand_double (rand);
52 g_assert (d >= 0 && d < 1);
54 d = g_random_double ();
55 g_assert (d >= 0 && d < 1);
57 d = g_rand_double_range (rand, -8, 32);
58 g_assert (d >= -8 && d < 32);
60 d = g_random_double_range (-8, 32);
61 g_assert (d >= -8 && d < 32);
63 b = g_random_boolean ();
64 g_assert (b == TRUE || b == FALSE);
66 b = g_rand_boolean (rand);
67 g_assert (b == TRUE || b == FALSE);