'How to generate an array only containing 0.0 and 1.0 in python

I want to create an array only containing 0.0 and 1.0 with a size [20,3].

I tried using the function: np.random.randint(0,2,[20,3]), but it only returned 0 and 1 instead of 0.0 and 1.0.

I am new to python code, if the question is not clear, I am open to made some edits to it. Thank you in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source