Ken Kundert wrote on Nov 16th, 2006, 7:20pm:It was a completely arbitrary choice. The only criteria I used was to use a different seed for each rdist function present in the system. If you give the same seed to two different rdist functions they will produce an identical sequence of random numbers.
By "two different rdist functions" Ken does not mean to say that $rdist_normal() and $rdist_uniform will give the same sequence of random numbers. I am fairly sure he meant "give the same seed to two different calls of the same rdist function":
Modifying the example:
integer n, seed, seed2;
real next, dT, dT2;
analog begin
@(initial_step) begin
seed = 286;
seed2 = 286;
next = 0.5/freq + $abstime;
end
@(timer(next)) begin
n = !n;
dT = jitter*$rdist_normal(seed,0,1);
dT2 = jitter*$rdist_normal(seed2,0,1); // will have the same sequence of values as dT
next = next + 0.5/freq + `M_SQRT1_2*dT;
end
V(out) <+ transition(n ? vh : vl, 0, tt);
end
dT2 will have the exact same sequence of random values as dT. Also, seed and seed2 are changed by the $rdist function calls, and the sequence of their values will be the same.
I wonder: if you did
rn1 = $rdist_normal(seed,0,1);
rn2 = $rdist_uniform(seed2,-1,1);
will "seed" and "seed2" have the same sequence of (integer) values? I guess you might or might not, since the LRM doesn't say.
-Geoffrey