discuss-gnuradio
[Top][All Lists]
Advanced

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

[Discuss-gnuradio] gr_noise_source_X( ) only negative seeds?


From: Tim Meehan
Subject: [Discuss-gnuradio] gr_noise_source_X( ) only negative seeds?
Date: Thu, 8 Mar 2007 16:06:35 -0800

Hi All

When seeded with a positive number gr_noise_source_X seems to always
return the same sequence.

i.e.

call gr_noise_source_f(gr.GAUSSIAN,1,Z) where Z > 0 the sequence is
always the same.  Called with a negative seed (Z < 0 ) it behaves as I
would expect.

Am I missing something?

I think this is from lines below in gr_random, but the comment
made me scared to touch it :-)

/*
* This looks like it returns a uniform random deviate between 0.0 and 1.0
* It looks similar to code from "Numerical Recipes in C".
*/
float gr_random::ran1()
{
 int j;
 long k;
 float temp;

 if (d_seed <= 0 || !d_iy)  {
   if (-d_seed < 1)                    <<<<<<<<<<  HERE
     d_seed=1;                         <<<<<<<<<<  and HERE
   else
     d_seed = -d_seed;
   for (j=NTAB+7;j>=0;j--) {
     k=d_seed/IQ;
<snip>




reply via email to

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