To all my h4x0rs:

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


saaski_moql June 15 2007, 23:29:37 UTC
I could, um, ask my brother to do it...

Reply


jigpu June 16 2007, 01:39:14 UTC
What kind of webdeveloper have I made that does not know of Javascript? o.O

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

jigpu June 16 2007, 02:09:30 UTC
And because I am still in love with LOLCODE, here's one in that language (there is no random number function yet, so I'm copying the implementation of the one that BSD uses)

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

sutematsu June 19 2007, 12:17:06 UTC
Holy CRAP that's cool..... (0_0) Does that stuff actually WORK? Also, you built the kind of web developer which only heard (about javascript): "Copy it off the internet. None of it is proprietary anyway." And therefore she does not know what javascript is actually used for or capable of. *raspberry*

Reply


Leave a comment

Up