Randomize problem

hi,
that’s my first time in uvm.
i download the code of the course basic uvm. then i connected my DUT to the code.
i receive this from the Modelsim:

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 15: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 25: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 35: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 45: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 55: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 65: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 75: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 85: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

UVM_INFO E:/uvm/files/uvm_basics_complete.sv(65) @ 95: reporter [mg] DUT received cmd=1, addr= 304, data=2463316041

how can i get random addr and random data every iteration? what can i change?

and another little problem…
this is part of the code:

 rand int n;
    
    constraint how_many { n inside {[2:4]}; }
    
    function new (string name = "");
      super.new(name);
    endfunction: new
	  task body;
      repeat(n)
      begin
        read_modify_write seq;
        seq = read_modify_write::type_id::create("seq");
        assert( seq.randomize() );
        seq.start(p_sequencer);
      end
    endtask: body

why the variable ‘n’ doesn’t stop the simulation after 4 iteration?

thank’s!

In reply to yosi84:

Hi,

To get the different values do not create it on every iteration

In reply to yosi84:

Your code is wrong. Remove the line ‘assert( seq.randomize() );’ as sshown in the slides of the UVM Basic Course. Follow the steps shown in the course.