3 ms·
You don't want to modulo. You want to multiply the last digit by the number of children and divide by ten.
by baddox 12y ago
You don't want to modulo. You want to multiply the last digit by the number of children and divide by ten.
- lutusp 12y ago> You don't want to modulo. You haven't thought your reply through: n n % 4 ---------- 0 0 1 1 2 2 3 3 4 0 5 1 6 2 7 3 8 0 9 1 10 2 11 3 12 0 13 1 14 2 15 3 > You want to multiply the last digit by the number of children and divide by ten. That doesn't produce the result you think it does. Think a bit harder. If the last digit is 20, and there are four children, the result is 4 * 20 / 10 = 8. There is no eighth child.
- baddox 12y agoYeah, I was joking. The point is that either way you get a non-uniform distribution for n children unless n divides 10. I think the part you are misunderstanding in your responses is that the last digit of a clock has only ten options: 0 through 9. In the tables you have posted, children 0 and 1 each win 30% of the time, while children 2 and 3 each win only 20% of the time. With a single generation, you can't uniformly choose from a set of n options with a random number generator that outputs m options, unless n divides m.
- lutusp 12y ago> I think the part you are misunderstanding in your responses is that the last digit of a clock ... Digits, not digit. I doubt this fact will limit the number of airheads who downvote posts containing useful content.
- baddox 12y agoYour last comment said > If the last digit is 20, and there are four children, the result is 4 * 20 / 10 = 8. Singular "digit."
- lutusp 12y agoDo you actually think the point is to argue with people who actually know things, like a lawyer instead of a scientist? Using a modulo operator is the obvious solution to the original question, and cowardly anonymous downvotes can't erase simple facts -- but they eventually make them have so little contrast on the display that they become unreadable. What an achievement.
- DanBC 12y agoNearly everytime you mention downvotes: the reason is tone and attitude. I don't know if you are aware just how much your tone influences the downvotes.
- lutusp 12y ago> Nearly everytime you mention downvotes: the reason is tone and attitude. Look -- I posted the obvious solution to a common problem. Everything else depends on those who can't stand the unwelcome intrusion of simple, easily stated facts. My "attitude" is that this problem is easily solved, using simple arithmetic. Imagine you're a scientist -- as such, do you object to a useful result because of its source?
- DanBC 12y agoI say this to help you, feel free to ignore it. When you get a downvote, ignore it. It's probably accidental or meaningless and these tend to self correct over a day. When people downvote a bunch of your posts in a thread IGNORE THE DOWNVOTES. Vindictive downvote sprees are usually corrected over the course of the day. Mentioning the downvotes will usually prevent those corrective upvotes. Me tioning the downvotes in the unpleasant way that you do will attract downvotes. You may wish to consider how you're presenting the information. If the first table of numbers gets downvotes posting the same table again without more information is going to get the same downvotes. You could argue that it should not be this way, but it is.
- 12y ago
- deleted 12y ago[deleted]
- lutusp 12y ago> You don't want to modulo. You want to multiply the last digit by the number of children and divide by ten. Let's see how this turns out: n n * 7 / 10 -------------- 0 0 1 0 2 1 3 2 4 2 5 3 6 4 7 4 8 5 9 6 It's the same for most other numbers of children. Thanks for playing, no cigar.