![]() Topic awaiting preservation: A little exercise for all of you (Page 1 of 1) |
|
---|---|
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() 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 |
![]() 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 |
![]() mhm i would do that with some mathimatical functions... HEH *looksovertomax* |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() 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 |
![]() Hi, Slime. |
Nervous Wreck (II) Inmate From: Utreg, NL |
![]() 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 |
![]() Alright the only question is whether this is correct probablity wise. |
Nervous Wreck (II) Inmate From: |
![]() How about the following? |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() Yup, that works. |