In reply to K_123:
According to the SystemVerilog LRM, random variables can only have integral types. You can use post_randomize to convert an integral value to a real.
class A;
rand int freq_int;
real freq_real;
constraint f { freq_int inside {21, 32, 43};}
function void post_randomize();
freq_real = freq_int/10.0;
endfunction
endclass
freq_real will be 2.1, 3.2, or 4.3.