grand.inc 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. {*
  2. * grand.inc
  3. *
  4. * depends on gtypes.inc
  5. *}
  6. type
  7. PGRand = pointer; // check please
  8. { GRand - a good and fast random number generator: Mersenne Twister
  9. see http://www.math.keio.ac.jp/~matumoto/emt.html for more info.
  10. The range functions return a value in the intervall [begin, end).
  11. int -> [0..2^32-1]
  12. int_range -> [begin..end-1]
  13. double -> [0..1)
  14. double_range -> [begin..end)
  15. }
  16. function g_rand_new_with_seed(seed:guint32):PGRand;cdecl;external gliblib name 'g_rand_new_with_seed';
  17. function g_rand_new:PGRand;cdecl;external gliblib name 'g_rand_new';
  18. procedure g_rand_free(rand:PGRand);cdecl;external gliblib name 'g_rand_free';
  19. procedure g_rand_set_seed(rand:PGRand; seed:guint32);cdecl;external gliblib name 'g_rand_set_seed';
  20. function g_rand_boolean(rand : PGRand) : gboolean;
  21. function g_rand_int(rand:PGRand):guint32;cdecl;external gliblib name 'g_rand_int';
  22. function g_rand_int_range(rand:PGRand; _begin:gint32; _end:gint32):gint32;cdecl;external gliblib name 'g_rand_int_range';
  23. function g_rand_double(rand:PGRand):gdouble;cdecl;external gliblib name 'g_rand_double';
  24. function g_rand_double_range(rand:PGRand; _begin:gdouble; _end:gdouble):gdouble;cdecl;external gliblib name 'g_rand_double_range';
  25. procedure g_random_set_seed(seed:guint32);cdecl;external gliblib name 'g_random_set_seed';
  26. function g_random_boolean : gboolean;
  27. function g_random_int:guint32;cdecl;external gliblib name 'g_random_int';
  28. function g_random_int_range(_begin:gint32; _end:gint32):gint32;cdecl;external gliblib name 'g_random_int_range';
  29. function g_random_double:gdouble;cdecl;external gliblib name 'g_random_double';
  30. function g_random_double_range(_begin:gdouble; _end:gdouble):gdouble;cdecl;external gliblib name 'g_random_double_range';