Jun 15, 2007 07:15
So....anybody want to write a program that will generate a random number between 1 and 20 for me? I promise, it's for a really nerdy cause.
(Or I guess you could teach me how to do it myself, but I don't believe I have a compiler on this computer for anything except Visual Basic, and not even sure about that.)
Leave a comment
Comments 5
Reply
Reply
Math.random() spits out a number between 0 and 1, we multiply that by 20 to get a number between 0 and 20, and then run "ceiling" to round-up the number.
Reply
HAI
CAN HAS STDIO?
I HAS A seed
GIMMEH seed
IZ seed SMALR THAN 0? DIAF -1 "SEED IS NEGATIVE!"
I HAS A longcat ITZ 2147483648
I HAS A ceilingcat ITZ 1103515245
I HAS A trashcat ITZ 12345
I HAS A RANDOM ITZ PRON seed ceilingcat TIMEZ trashcat UP longcat MOD
VISIBLE RANDOM
KTHXBYE
( ... )
Reply
Reply
Leave a comment