Randomness

Anything you've been wondering about in science or the science in science fiction.

Moderator: Moderators

Randomness

Postby Brightonian » Thu Dec 23, 2010 8:51 am

Why is it that however many times I click the "random" button at xkcd.com, I never get the same strip twice? I don't believe it's truly random.
Brightonian
 
Posts: 480
Joined: Tue Mar 21, 2006 1:56 pm
Location: Brighton, UK

Re: Randomness

Postby temp » Thu Dec 23, 2010 2:19 pm

my guess, each strip has an id to uniquely identify each one. For simplicity, say the id is just a number. When you click next, it just bumps to the next one in line..i.e. 1,2,3,4, etc...

so...maybe it's "random order", as opposed to just "random".

i.e. a random order of numbers from 1 to 5 might be: 5,1,2,3,4.

..then when you hit random, it just bumps you to the next one in this predefined random order.

When I hit random on my ipod and move the next song, I think it really is random because sometimes I get the same song again.

...computers inherently cannot create a true random number anyway.

For example, in this C snippet, I use the the current time to generate a seed value, and then this is used as a basis for generating a random number between 0 and maxNum.

time_t t1;
time(&t1);
srand48((unsigned long)t1);
randNum1 = (lrand48() % maxNum)

http://linux.about.com/library/cmd/blcmdl3_srand48.htm
User avatar
temp
 
Posts: 254
Joined: Tue Feb 01, 2005 4:38 pm
Location: Toronto

Re: Randomness

Postby Brightonian » Fri Dec 24, 2010 4:46 am

That makes sense, but doesn't it imply that I would get the same random sequence whenever I visit the site? I see I'll have to do some more experiments.
Brightonian
 
Posts: 480
Joined: Tue Mar 21, 2006 1:56 pm
Location: Brighton, UK


Return to Science questions

Who is online

Users browsing this forum: No registered users and 0 guests

cron