I have a variable, x, and I want to set it to the values either 1 or 2, with a 60% probability x=1 and a 40% x=2.
I'm doing this in a class, so x should regenerate each time a button is clicked and I'll then plot it, but I'm not sure how to set it using specific probabilities. I know I could do it randomly but that's not quite what I want.
Does anyone know how to do this?