In reply to samir singh:
With the constraints you had you can use $urandom_range or std::randomize().
For complex randomization you should use std::randomize().
Also, The code which you wrote will assign 0/1 to addr variable because you are assigning the return value of std::randomize() function to addr.