In reply to dave_59:
Here is the code:
class packet;
randc int i;
constraint i_range {i >= 1; i <=1000;}
endclass:packet
module cubes;
int j;
initial
begin
packet p = new;
repeat(1000)
begin
p.randomize();
for(j=1;j<=10;j++)
begin
if (j*j*j == p.i) //I want to use if( j == (p.i)^(1/3)) or anyother expression that uses cube root of p.i instead of cube of j
$display ("cube is %d and its root is %d",p.i,j);
end
end
end
endmodule: cubes