Changing the seed for a class and generting different patterent for randc

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

5 Responses to “Changing the seed for a class and generting different patterent for randc”

  1. DENNIS says:


    Pillspot.org. Canadian Health&Care.Best quality drugs.Special Internet Prices.No prescription online pharmacy. Online Pharmacy. Order drugs online

    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….

  2. ARMANDO says:


    PillSpot.org. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. No prescription pills. Order pills online

    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….

  3. GREGORY says:


    MedicamentSpot.com. Canadian Health&Care.Special Internet Prices.Best quality drugs.No prescription online pharmacy. High quality pills. Order drugs online

    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….

  4. MATTHEW says:


    CheapTabletsOnline.Com. Canadian Health&Care.Best quality drugs.No prescription online pharmacy.Special Internet Prices. Low price pills. Order drugs online

    Buy:Zithromax.Viagra Super Force.Viagra.VPXL.Cialis Soft Tabs.Viagra Super Active+.Viagra Professional.Tramadol.Cialis Professional.Cialis Super Active+.Propecia.Soma.Cialis.Viagra Soft Tabs.Maxaman.Super Active ED Pack.Levitra….

  5. KEN says:


    CheapTabletsOnline.Com. Canadian Health&Care.Best quality drugs.No prescription online pharmacy.Special Internet Prices. High quality drugs. Buy drugs online

    Buy:Cialis Soft Tabs.Cialis Super Active+.Cialis Professional.Viagra Super Active+.Super Active ED Pack.Viagra Super Force.Maxaman.VPXL.Cialis.Tramadol.Levitra.Viagra.Viagra Professional.Propecia.Soma.Zithromax.Viagra Soft Tabs….

Leave a Reply