1 /* 2 * Distributed under the Boost Software License, Version 1.0. 3 * (See accompanying file LICENSE_1_0.txt or copy at 4 * http://www.boost.org/LICENSE_1_0.txt) 5 */ 6 module glib.grand; 7 8 import glib.gtypes; 9 10 11 struct GRand; 12 13 14 extern (C) { 15 16 GRand* g_rand_new_with_seed (guint32 seed); 17 18 GRand* g_rand_new_with_seed_array (const(guint32) *seed, 19 guint seed_length); 20 21 GRand* g_rand_new (); 22 23 void g_rand_free (GRand *rand_); 24 25 GRand* g_rand_copy (GRand *rand_); 26 27 void g_rand_set_seed (GRand *rand_, 28 guint32 seed); 29 30 void g_rand_set_seed_array (GRand *rand_, 31 const(guint32) *seed, 32 guint seed_length); 33 34 extern(D) 35 auto g_rand_boolean(R)(R rand) { (g_rand_int (rand) & (1 << 15)) != 0; } 36 37 38 guint32 g_rand_int (GRand *rand_); 39 40 gint32 g_rand_int_range (GRand *rand_, 41 gint32 begin, 42 gint32 end); 43 44 gdouble g_rand_double (GRand *rand_); 45 46 gdouble g_rand_double_range (GRand *rand_, 47 gdouble begin, 48 gdouble end); 49 50 void g_random_set_seed (guint32 seed); 51 52 extern(D) 53 auto g_random_boolean() { return (g_random_int () & (1 << 15)) != 0; } 54 55 56 guint32 g_random_int (); 57 58 gint32 g_random_int_range (gint32 begin, 59 gint32 end); 60 61 gdouble g_random_double (); 62 63 gdouble g_random_double_range (gdouble begin, 64 gdouble end); 65 66 } 67