I want to generate a random array of size N which only contains 0 and 1, I want my array to have some ratio between 0 and 1. For example, 90% of the array be 1 and the remainin
You could use a binomial distribution:
np.random.binomial(n=1, p=0.9, size=[1000])