In reply to perumallatarun:
Random ‘real’ number can be selected by randomizing non-integral variable and passing it to built-in SV 1800-1200 Mathematics Function which gives real number. Input to built-in math function should be controlled as per desired result.
E.g.
// Purpose: Randomize non-integer(real, shortreal, realtime) values
module top;
class non_integer;
rand int in;
real in1;
constraint c_in {in > 1;}
function void post_randomize();
in1 = $ln(in);
endfunction // post_randomize
endclass // non_integer
initial
begin
non_integer ni;
ni = new();
if(!ni.randomize())
begin
$display("Randomize failed");
end
else
begin
$display("Non Real Number: in = %d", ni.in);
$display("Real Number: in1 = %f", ni.in1);
end
end
endmodule // top