In reply to dave_59:
I tried to call the foo function with bit vector with size of 8, and got the following error:
Illegal function inout argument.
Foo function:
function void foo_arr_bit (inout bit [31:0] mem, int size, string mem_name);
for (int i=0; i< size(); i++)
mem[i] = my_randomize_int(mem[i], mem_name);
endfunction: foo_arr_bit
Calling foo:
foo_arr_bit (data_bit, 8, "data_bit");