Reply To: Help on using DistValInt

Why OSVVM™? Forums OSVVM Help on using DistValInt Reply To: Help on using DistValInt

#417
Jim Lewis
Member

Hi Alvin,
You need to show more code. I can’t tell how many times you call DistValInt. What I would expect to see is:

process
  variable rndx  : RandomPType;
  variable tmp_val : integer;
begin
rndx.InitSeed(SEED);  -- do one time.

loop
  tmp_val := rndx.DistValInt(((1,1),(2,5),(3,3),(4,1)));
  -- do something
end loop ;

One key point is that the seed is a state variable and is only set one time at the beginning. A given seed will always produce the same sequence – this is important for test stability. WRT trying different seeds and always getting a 1 first – this is possible since you have a 25% chance of it happening. Although several generate the same initial value, it is likely that they will generate a different sequence.

Have you looked at RandomPkg_user_guide.pdf?

Best,
Jim