Seed for UVM_SEQUENCE_ITEM

What you can do is get the randstate of the process from where you call randomize() on the transaction and store that. Whenever you need to re-generate this transaction you spawn a new process and set its randstate to the one you saved:


task some_task(); 
  string rand_state; 
  process p = process::self(); 
  rand_state = p.get_randstate(); 
  
  // here you would call your first randomize() ...
  // you would save rand_state instead of the randomized transaction
endtask


// this task regenerates a trans based on the rand_state
// - not sure if it has to be a task or a function with a
//   return value would do
task regen(transaction trans, string rand_state);
  process p = process::self();
  p.set_randstate(rand_state); 
  trans.randomize(); // should yield the same result as the first time
endtask


// somewhere else
// fork it off to have a new process
fork
  regen(trans, rand_state)
join

This code is just off the top of my head. You need to figure out the exact details. I’m not sure how this would affect random stability, but I’m guessing if you fork a new process when you want to re-generate you should be fine.