In reply to dave_59:
In reply to designer007:
You typically use a random seed each time you run a testcase. To debug a testcase failure, you use a specific number to repeat the same series of random numbers generated for that seed.
I try vsim -sv_seed random 2 times;
task automatic test_rand();
for(int i=0;i<32;i++) begin
$display("rand test1 : %h seed: %h",$urandom, $get_initial_random_seed );
$display("rand test2 : %h",$urandom(98));
$display("rand test 10: %h",{$random()}%10);
$display("urand test : %h",$urandom_range(32));
end
endtask
but rand test1 result is same , with diff seed
1st rst:
rand test1 : 99b8d01f seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000001
urand test : 0000000d
rand test1 : 7072cfdf seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000000
urand test : 0000000d
rand test1 : 7072cfdf seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000005
urand test : 0000000d
rand test1 : 7072cfdf seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000007
urand test : 0000000d
rand test1 : 7072cfdf seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000004
urand test : 0000000d
rand test1 : 7072cfdf seed: dbb145f2
rand test2 : cfccd4ba
rand test 10: 00000000
2nd rst: