From this, you have a sequence of uniformly random bits, from which you can construct a uniformly random number between 1 and 10. A simple way (although, again, likely leaving entropy on the table) is to break these bits into groups of 4; interperate them as 4 bit unsigned integers, and discard any result that is not in the range 1-10.
How to pick a random number from 1-10
11–20 of 183 posts
Re: How to pick a random number from 1-10
#120-9: Look at the second hand on your watch, what is the last digit? odd/even or heads/tails: is the seconds odd or even?
Re: How to pick a random number from 1-10
#13Earlier quoted context omitted.
Most people have at least 10 digits memorized? That is one bold claim
I meant here on Hacker News. I would guess most of us here played with our TI-83s enough to know the first 10
Re: How to pick a random number from 1-10
#14I was thinking through the post that this sounds like a straightforward problem and it is: https://stackoverflow.com/a/5953133/86433
Except the introduction of an "ideally" optimization condition turns it from a straightforward transform into something requiring a linear programming solver. I wonder if the resultant algorithm is actually any simpler though...
Re: How to pick a random number from 1-10
#151 liner.
--
EDIT: I lied, this doesn't work, it biases towards 1-5. I guess you could convert to decimal, and divide by (FFFFFFFFFFFFF / 10)
Re: How to pick a random number from 1-10
#16Earlier quoted context omitted.
It's still an unsolved problem whether or not the digits of pi are uniformly distributed.
Just try it out for yourself. Analyze the distribution of the first billion digits and I think you'll find they will produce a more uniform distribution than this algorithm in the article given 1 billion human responses...
Re: How to pick a random number from 1-10
#17Earlier quoted context omitted.
I meant here on Hacker News. I would guess most of us here played with our TI-83s enough to know the first 10
I wonder how many people on HN have even seen a TI-83, I don’t think I’ve seen one since I sold mine when I finished the Danish equivalent of high school in 99. I mean, they were apparently discontinued in 2004, that’s 15 years ago.
Re: How to pick a random number from 1-10
#18Maybe an easier solution would be to append all the answers, take a hash (e.g. sha1), then convert the last 2 digits from hex to decimal, and mod 10. 1 liner. -- EDIT: I lied, this doesn't work, it biases towards 1-5. I guess you could convert to decimal, and divide by (FFFFFFFFFFFFF / 10)
Re: How to pick a random number from 1-10
#19There is a simpler solution if you do not mind leaving entropy on the table. Break the people up into groups of two without regard for their selection. If two people provide the same number, ignore them. Otherwise, output "0" if the first person's number is smaller then the second, and output "1" if the first person's number is larger. From this, you have a sequence of uniformly random bits, from which you can constr…
EDIT: Not quite that many, more like around 9, 18, 27 or so, see below.
Re: How to pick a random number from 1-10
#20Maybe an easier solution would be to append all the answers, take a hash (e.g. sha1), then convert the last 2 digits from hex to decimal, and mod 10. 1 liner. -- EDIT: I lied, this doesn't work, it biases towards 1-5. I guess you could convert to decimal, and divide by (FFFFFFFFFFFFF / 10)
Can you do a SHA1 in your head?