Changeset: ff8072a9696f for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ff8072a9696f
Modified Files:
        common/utils/mtwist.c
        common/utils/mtwist.h
        gdk/gdk_sample.c
Branch: stratified_sampling
Log Message:

Fix typos


diffs (48 lines):

diff --git a/common/utils/mtwist.c b/common/utils/mtwist.c
--- a/common/utils/mtwist.c
+++ b/common/utils/mtwist.c
@@ -189,7 +189,6 @@ inline double mtwist_drand(mtwist* mt) {
  * [a,b] 
  */
 inline int mtwist_uniform_int(mtwist* mt, int a, int b) {
-    return mtwist_u32rand(mt)%b;
     if(b < a) {//invalid range!
         return 0;
     }
diff --git a/common/utils/mtwist.h b/common/utils/mtwist.h
--- a/common/utils/mtwist.h
+++ b/common/utils/mtwist.h
@@ -60,8 +60,8 @@ void mtwist_free(mtwist* mt);
 
 /* methods */
 void mtwist_seed(mtwist* mt, unsigned int seed);
-inline unsigned int mtwist_u32rand(mtwist* mt);
-inline double mtwist_drand(mtwist* mt);
-inline int mtwist_uniform_int(mtwist* mt, int a, int b);
+unsigned int mtwist_u32rand(mtwist* mt);
+double mtwist_drand(mtwist* mt);
+int mtwist_uniform_int(mtwist* mt, int a, int b);
 
 #endif
diff --git a/gdk/gdk_sample.c b/gdk/gdk_sample.c
--- a/gdk/gdk_sample.c
+++ b/gdk/gdk_sample.c
@@ -162,11 +162,18 @@ BATsample(BAT *b, BUN n)
                        return NULL;
                }
                /* while we do not have enough sample OIDs yet */
+        
+        /* create and seed Mersenne Twister */
+        mtwist *mt_rng = NULL;
+        mt_rng = mtwist_new();
+        mtwist_seed(mt_rng, rand());
+        
                for (rescnt = 0; rescnt < n; rescnt++) {
                        oid candoid;
                        do {
                                /* generate a new random OID */
                                candoid = (oid) (minoid + DRAND * (maxoid - 
minoid));
+                candoid = (oid) (minoid + ())
                                /* if that candidate OID was already
                                 * generated, try again */
                        } while (!OIDTreeMaybeInsert(tree, candoid, rescnt));
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to