In python the closest I could find was (untested): sum(random.sample([1, 0], spoon_size, counts=[soup_count, water_count]))
But this would create an intermediate list of length spoon_size which is not a good idea.
In python the closest I could find was (untested): sum(random.sample([1, 0], spoon_size, counts=[soup_count, water_count]))
But this would create an intermediate list of length spoon_size which is not a good idea.
Interesting. I don't know why I didn't think of just keeping a count of soup molecules. Must have been late!
Another interesting point, your simulation is subtly wrong in a different way from my calculation. When there is only one soup molecule left, there is a chance (however tiny) that rbinom
will return 2 or more, taking out more soup molecules than there really are.
If you run it enough times with a bowl of 3 molecules and a spoon of 2 molecules, I'm sure you'll hit -1 soup molecules some of the time.
For a simulation I think we can do better. There must be a random function that does it properly. The function we want is like pulling balls of 2 colors out of a sack without replacement. Pretty common combinatorics question, I would expect a random function to match.
By the way, how did you actually stimulate it? Surely you didn't keep 10^25 variables in memory...
You rock! Thank you :)
If I find myself in the right mood I might try to work out the actual distribution. If I do, your simulation will be a very handy sanity check!
This was posted in a memes community so I'm looking for anything funny about it but I just can't see it.
This is an anti-AI blog, that tagline is a joke.
how do you hijack a sentient plane?
I'm glad you asked. https://en.wikipedia.org/wiki/Ophiocordyceps_unilateralis
I've been looking at this for quite a while and I just don't get it.
:)
What I would like to do is give a margin of error, e.g. "there is a 95% change that it will be between spoonful 1000 and spoonful 1300" or something like that. But I don't have the time to figure that out now, sounds like it would be harder to figure out than the expected value.
Of the answers I've seen this is the one that makes most sense.
Of course, the real answer is that the sink is haunted.
I got 1022 as the expected value, see my top level comment.
Edit: oops, made a big mistake. Will fix it!
Edit: after correcting I got 1144, much closer to your result 1132.
/u/TranquilTurbulence@lemmy.zip fairly sure the distribution you should use is hypergeometric distribution, found via urn problem.