The Ugly Code-Duckling #4

Hi again. I’m back again. After the exam today there are only two more to go and until now I didn’t fail any of them - what is very nice :)

While chatting with some fellow students I got the inspiration for this new ugly code duckling from Clemens. This one was not commited by any of my students, but was found somewhere in the internet. I can’t recall Clemens mentioning where he found this snippet, but I think it is worth being published here. Enjoy!

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

(I’ve been told via a comment that this source has it’s origin at www.xkcd.com. Because the anonymous contributer did not leave a valid e-mail address I deleted his comment.)


About this entry