commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10222 - gnuradio/branches/developers/eb/gcell-wip/gce


From: eb
Subject: [Commit-gnuradio] r10222 - gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu
Date: Wed, 14 Jan 2009 01:16:14 -0700 (MST)

Author: eb
Date: 2009-01-14 01:16:12 -0700 (Wed, 14 Jan 2009)
New Revision: 10222

Modified:
   gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_random.c
Log:
fixed random number generator

Modified: 
gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_random.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_random.c 
2009-01-14 07:41:13 UTC (rev 10221)
+++ gnuradio/branches/developers/eb/gcell-wip/gcell/lib/runtime/spu/gc_random.c 
2009-01-14 08:16:12 UTC (rev 10222)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -22,9 +22,9 @@
 
 static int last_val = 0;
 
-#define        M  714025       // values from Numerical Recipes in C, 1988
-#define A    4096
-#define C  150889
+#define        M  259200       // values from Numerical Recipes in C, 1988
+#define A    7141
+#define C   54773
 
 void 
 gc_set_seed(int seed)
@@ -36,5 +36,5 @@
 gc_uniform_deviate(void)
 {
   last_val = (last_val * A + C) % M;
-  return (float) last_val / (float) M;
+  return (float) last_val * (1.0f / (float) M);
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]