xkcd #221: Random Number (9 Nov 2007)

cross-posted from: https://programming.dev/post/8677292


Transcript:

[A computer program.]

int getRandomNumber()
{
   return 4; // chosen by fair dice roll.
             // guaranteed to be random.
}

Hover Text:

RFC 1149.5 specifies 4 as the standard IEEE-vetted random number.

331 points · 15 comments · view on lemmy.world

15 Comments

LazaroFilm@lemmy.world · 38 pts · 2y (2 replies)

I prefer using a whole wall of lava lamps for a random number.

MNByChoice@midwest.social · 10 pts · 2y (1 reply)

Seems like the place to share. Ages ago a group epoxied a webcam and used the random flashes (from cosmic rays?) as their source of randomness.

rmuk@feddit.uk · 14 pts · 2y

I think what they're referring to is a company - I think it's CloudFlare - who use a bunch of physical randomness generators to seed their commercial random number generator. One of those seeds is a webcam pointed at a load of lava lamps.

https://youtu.be/1cUUfMeOijg

lamabop@lemmings.world · 21 pts · 2y

Incredible, cracked the pseudorandomness problem with this simple code that guarantees a random whole number greater than 3 and less than 5.

Thorry84@feddit.nl · 19 pts · 2y (2 replies)

Just update the code once a year to a different number, given long enough time the output will have a perfectly flat distribution.

veroxii@aussie.zone · 9 pts · 2y (1 reply)

I mean, how many random numbers can there even be?

cron@feddit.de · 4 pts · 2y

Not more than six, at least if you use a standard dice.

captainjaneway@lemmy.world · 13 pts · 2y (4 replies)

I generate a random number and then use that number as a seed. I then generate a random number. Then I use that number as a seed. I then generate a random number. I divide that number by a random prime number picked in a similar fashion. I take the last n-digits of the remainder and that's the random number I give to a user.

Trabic@lemm.ee · 12 pts · 2y (2 replies)

Was it 4?

captainjaneway@lemmy.world · 8 pts · 2y (1 reply)

maybe

Crashumbc@lemmy.world · 4 pts · 2y

42

Spzi@lemm.ee · 7 pts · 2y

That's already pretty cool! It surely does generate very random numbers. I still think you can take it a step – or a random number of steps, hah! – further by repeating the process a random number of times! Maybe this way we can reach maximum randomness. Probably need to reroll the number until it's big enough for that.

I would also check if the result is 4. If it's 4, it should be discarded. 4 is not an actual random number but a joke random number from a comic.

pantyhosewimp@lemmynsfw.com · 3 pts · 2y

And it’s indempotent!

AKADAP@lemmy.ml · 3 pts · 2y

Wasn't that then number always returned by the PS3 random number generator used in their DRM?

dog_@lemmy.world · 1 pts · 2y

Thanks PS3!