Here is the example. How you can change the seed for a class and generate different pattern with randc.
If you comment the line “obj.srandom(seed)” it will generate the same pattern again after the cycle.
Try compiling it again with commenting above line.
class randctest;
randc bit [1:0] randbit;
task print;
$display(”Rand C = %d”, randbit);
endtask
endclass
program main;
randctest obj;
initial begin
obj = new();
for (int i=0; i<12; i++) begin
if (i % 4 == 0) begin
obj.srandom(236+i);
$display(”==============”);
end
if (obj.randomize()) begin
obj.print();
end
else begin
$display(”Randomization failed \n”);
end
end
end
endprogram : main
Output :
==============
Rand C = 0
Rand C = 1
Rand C = 2
Rand C = 3
==============
Rand C = 2
Rand C = 1
Rand C = 3
Rand C = 0
==============
Rand C = 1
Rand C = 0
Rand C = 2
Rand C = 3
Buy:Ventolin.Amoxicillin.Lipitor.Cozaar.Acomplia.Zetia.Aricept.Female Cialis.Benicar.Advair.Zocor.SleepWell.Buspar.Seroquel.Female Pink Viagra.Wellbutrin SR.Prozac.Lasix.Lipothin.Nymphomax….
Buy:Viagra Soft Tabs.Cialis Professional.Cialis Super Active+.Cialis Soft Tabs.Cialis.Maxaman.Viagra Super Active+.Soma.Zithromax.Viagra Super Force.Super Active ED Pack.Viagra Professional.Viagra.Levitra.Tramadol.VPXL.Propecia….
Buy:Prevacid.Zyban.Petcam (Metacam) Oral Suspension.Synthroid.Nexium.Lumigan.Actos.Arimidex.Zovirax.Prednisolone.Human Growth Hormone.Mega Hoodia.Retin-A.100% Pure Okinawan Coral Calcium.Accutane.Valtrex….