I was picking football teams for my office's weekly "pick'em pool", and decided to pick randomly.

Since I only had a pencil and a legal pad handy, and I only needed outputs of 0 or 1 (0 being the home team wins, 1 being the away team wins) I invented my own "random number generator".

For each 2-team matchup, I generated an output by:

  1. drawing a zig-zag squiggle (sine-like random waveform, with near-zero bias) using a designated ruled line on my notepad as the x-axis.
  2. Then I counted the number of times the waveform intersected the ruled line.
  3. Then took that number mod 2 as my output.

Assuming each waveform was long enough (i.e. had at least 10 local minima and maxima) is my expected output somewhere near 0.5?

Just curious.

  • 5
    $\begingroup$ No, it will only depend on your habits about starting and ending the squiggle either above or below the axis. $\endgroup$ Commented Oct 11, 2012 at 22:02
  • $\begingroup$ Randomness tests might be of interest. They're all just heuristics, though. $\endgroup$
    – Snowball
    Commented Oct 11, 2012 at 22:09
  • 9
    $\begingroup$ Trade the pencil with someone else for a quarter. And then use the quarter. $\endgroup$
    – JACKY88
    Commented Oct 12, 2012 at 0:54

2 Answers 2


I know the OP is 7 years old, but you could have treated your pencil as a d6. Because a pencil has 6 edges, only one of which is usually printed on, assign 3 edges "team 1" (printed and adjacent edges), and 3 edges as "team 2" non-adjacent edges to printed edge), then roll the pencil across the desk, and see which edge comes up on top. Provided the pencil has no obvious blemishes or other problems that could influence a bias, this is a good HWRNG.


Given a closed curve in the plane which doesn't go through any point more than twice. The curve cuts the plane into regions, and if the outside is colored white, one can color all the regions black or white so no two regions meeting along an edge are the same color. (This is a standard graph theory result.)

This fact could be used to make a mod 2 random number generator, since if you draw a complicated enough curve with lots of regions, and then pick a region not very near the outside, you likely won't see immediately whether it would turn out black or white once the coloring is done.

But the color of a region can be found by drawing a ray from a point inside it which avoids the vertices, and counting mod 2 the number of intersections of the ray with the curve; you'll get odd or even depending on whether the region would end up black or white respectively.

So if you draw a really involved curve, then quickly pick a region near the middle, it seems you'd end up with a mod 2 result which didn't depend on your own "bias", as you yourself wouldn't know in advance what that parity would come out. Of course this doesn't apply if you are Rain Man. :=)

  • $\begingroup$ This is helpful! Thanks! I'm assuming I can extend your solution to mod N, assuming a curve with a large enough number of interior regions... $\endgroup$ Commented Oct 12, 2012 at 13:18
  • $\begingroup$ Well the overall count of the number of intersections on the way from the inner region to the outside would seem to be a random positive integer in some sense. You would know it was reasonably large if you made a quite complicated squiggle and chose a region near the middle. I think if the size of the squiggle was large compared to N you might arguabloy get a random number mod N. So I agree with your remark... $\endgroup$
    – coffeemath
    Commented Oct 14, 2012 at 5:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .