From: Andrey Kutejko Date: Thu, 11 Mar 2010 23:00:45 +0000 (+0200) Subject: added random functions X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=8289f20650e7b59fb19e97d603f07942bd4b8e80;p=cl-gtk2.git added random functions --- diff --git a/glib/cl-gtk2-glib.asd b/glib/cl-gtk2-glib.asd index 908923f..92dcb35 100644 --- a/glib/cl-gtk2-glib.asd +++ b/glib/cl-gtk2-glib.asd @@ -11,6 +11,7 @@ (:file "glib.quark") (:file "glib.gerror") (:file "glib.utils") + (:file "glib.rand") (:file "gobject.init") (:file "gobject.ffi.package") diff --git a/glib/glib.rand.lisp b/glib/glib.rand.lisp new file mode 100644 index 0000000..4849f73 --- /dev/null +++ b/glib/glib.rand.lisp @@ -0,0 +1,32 @@ +(in-package :glib) + +(defcfun (random-set-seed "g_random_set_seed") :void + (seed :uint32)) + +(export 'random-set-seed) + +(defcfun (random-int "g_random_int") :uint32) + +(export 'random-int) + +(defcfun (random-int-range "g_random_int_range") :int32 + (begin :int32) + (end :int32)) + +(export 'random-int-range) + +(defun random-boolean () + (logtest (random-int) #X8000)) + +(export 'random-boolean) + +(defcfun (random-double "g_random_double") :double) + +(export 'random-double) + +(defcfun (random-double-range "g_random_double_range") :double + (begin :double) + (end :double)) + +(export 'random-double-range) +