If you want an exact 1:9 ratio:
nums = numpy.ones(1000)
nums[:100] = 0
numpy.random.shuffle(nums)
If you want independent 10% probabilities:
nums = numpy.random.choice([0, 1], size=1000, p=[.1, .9])
or
nums = (numpy.random.rand(1000) > 0.1).astype(int)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…