[gegl] gegl: return a guint64 not gint64 from gegl_random_int()



commit 182401a45cc294668d61072d7ac391221859d3be
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 8 00:35:31 2013 +0100

    gegl: return a guint64 not gint64 from gegl_random_int()
    
    This is now the same as the GRand API, and automatically fixes
    gegl_random_int_range() which was returning out-of-range values
    because it wasn't doing the right thing for negative return values of
    gegl_random_int().

 gegl/gegl-random.c |    6 +++---
 gegl/gegl.h        |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gegl/gegl-random.c b/gegl/gegl-random.c
index 38d3bc5..4ba6a7e 100644
--- a/gegl/gegl-random.c
+++ b/gegl/gegl-random.c
@@ -211,7 +211,7 @@ gegl_random_get_set_for_seed (int seed)
   return cached;
 }
 
-static inline gint64
+static inline guint64
 _gegl_random_int (int seed,
                  int x,
                  int y,
@@ -232,7 +232,7 @@ _gegl_random_int (int seed,
   return ret;
 }
 
-gint64
+guint64
 gegl_random_int (int seed,
                  int x,
                  int y,
@@ -251,7 +251,7 @@ gegl_random_int_range (int seed,
                        int min,
                        int max)
 {
-  gint64 ret = _gegl_random_int (seed, x, y, z, n);
+  guint64 ret = _gegl_random_int (seed, x, y, z, n);
   return (ret % (max-min)) + min;
 }
 
diff --git a/gegl/gegl.h b/gegl/gegl.h
index fd97016..3cd653c 100644
--- a/gegl/gegl.h
+++ b/gegl/gegl.h
@@ -943,9 +943,9 @@ gint64 gegl_random_int_range    (int seed, int x, int y, int z, int n, int min,
  * @n: number no (each x,y coordinate provides its own sequence of
  * numbers
  *
- * Return a random integer number in range MIN_INT .. MAX_INT
+ * Return a random integer number in range 0 .. MAX_UINT
  */
-gint64 gegl_random_int          (int seed, int x, int y, int z, int n);
+guint64 gegl_random_int         (int seed, int x, int y, int z, int n);
 
 /**
  * gegl_random_double:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]