1)did you randomize class handles?and how?
In reply to anvesh dangeti:
Sorry, I do not understand your question. You do not randomize class handles, you randomize the object the handle refers to.
In reply to dave_59:
in verification guide mention below like this:
Following types can be declared as rand and randc,
singular variables of any integral type
arrays
arrays size
object handle’s
How can i randomize object handle’s?
In reply to anvesh dangeti:
I think what it means is you can randomize class variables, and the object referenced by the handle also will also have its rand variables as part of the randomization operation.
class A;
rand int i1;
endclass
class B;
rand int i2;
rand A a=new;
endclass
B b;
...
b= new;
assert(b.randomize());
When calling b.randomize, b.i2 and b.a.i1 will both get random values. Note that calling randomize() never constructs an object. If you leave b.a null, then b.a.i1 does not get a random value since it does not exist.