The argument to scope randomize must be a simple identifier of integral type


class drv;
// in task
// seq_item pkt (addr declared w/ soft constraint)
// tryna to re-randomize seq_item signal in driver but getting error
if(!(std::randomize(pkt.addr) with {pkt.addr inside {[0:18]};})) // The argument to scope randomize must be a simple identifier of integral type.
`uvm_error(get_full_name(), "RANDOMIZATION FAILED")
endclass

In reply to m_r_m:

From the LRM, the std::randomize() function operates on the integral variables of the current scope. You can’t reference any variables in sub-classes.