Generate sample data according to a suposed proportion
In R you could do: sample(c(1, rep(0, (1e6)-1)), size = 10)
You can adjust the sizing parameter accordingly. With size=10 you'll get 10 samples: [1] 0 0 0 0 0 0 0 0 0 0
It'll take a while before you see a 1 with this probability of 1/1e6.
I am working on a project where products in production have a defect, but in very rare cases. For example 1/1,000,000 products have a defect.
How could I generate data, in R, Python, or Excel, that would represent samples from this distribution ?