Topic awaiting preservation: A little exercise for all of you |
|
---|---|
Author | Thread |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-13-2003 06:32
OK, this is intended basically as practice for beginning to intermediate programmers. If the answer comes to you right away, don't say anything; let other people work it out for themselves. |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 07-13-2003 11:59
I couldn't resist, but to post my solution. It's a two line script (written in JavaScript, of course), one line for each number. Although, the script isn't "rocket science", it served as an exercise for using Math.random() function in JavaScript to generate random numbers (random as much as possible and with equal chance for all numbers to appear). |
Paranoid (IV) Inmate From: the space between us |
posted 07-13-2003 16:54
mhm i would do that with some mathimatical functions... HEH *looksovertomax* |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-13-2003 23:53
Wow, that's pretty complicated. I think it works almost the same as the solution that I had in mind, but I'm not sure. |
Paranoid (IV) Inmate From: NZ |
posted 07-14-2003 06:22
Hi, Slime. |
Nervous Wreck (II) Inmate From: Utreg, NL |
posted 07-14-2003 17:39
On another board we had a discussion like this one a while ago. A way that came up (I can't take full credit for this one) is to just sort a predefined list, something like this: code: var range = [0,1,2,3,4,5,6,7,8,9];
|
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
posted 07-14-2003 18:36
Alright the only question is whether this is correct probablity wise. |
Nervous Wreck (II) Inmate From: |
posted 07-15-2003 20:42
How about the following? |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 07-19-2003 02:16
Yup, that works. |