| View previous topic :: View next topic |
| Author |
Message |
me10c
Joined: 22 Nov 2008 Posts: 44
|
Posted: Sat Jul 18, 2009 6:13 pm Post subject: I need a simple code |
|
|
Can someone do this one for me please (yeah, I know, I am lazy)
80% chance to choose (if it doesnt choose add 0)
choose a number between 12-92 (including 12 and 92)
repeat 100 times
find the average number
ex (with 10 numbers) 0 12 0 92 10 15 54 24 0 33 = 24 average |
|
| Back to top |
|
 |
Matas
Joined: 07 Mar 2009 Posts: 49 Location: Europe, Lithuania
|
Posted: Sat Jul 18, 2009 6:19 pm Post subject: |
|
|
Your English is awful.. Can't understand what u want  |
|
| Back to top |
|
 |
me10c
Joined: 22 Nov 2008 Posts: 44
|
Posted: Sat Jul 18, 2009 6:22 pm Post subject: |
|
|
step 1 : 80% chance to generate a number. If it doesnt generate a number add 0.
step 2 : Generate a number between 12 and 92 (including them)
step 3 : Repeat step 1 and 2 100 times
step 4 : Show the average number (you saw the example)
how hard is to understand that o.O |
|
| Back to top |
|
 |
Matas
Joined: 07 Mar 2009 Posts: 49 Location: Europe, Lithuania
|
Posted: Sat Jul 18, 2009 6:57 pm Post subject: |
|
|
here u are, lazy guy..
| Code: | loop, 100
{
Random, chance, 1, 100
if chance > 80
Number = 0
Else
Random, number, 12, 92
sum += %number%
}
average := sum / 100
MsgBox, %average% |
|
|
| Back to top |
|
 |
me10c
Joined: 22 Nov 2008 Posts: 44
|
Posted: Sat Jul 18, 2009 7:36 pm Post subject: |
|
|
I didnt knew how to make the
| Code: | Random, number, 12, 92
sum += %number%
}
average := sum / 100
MsgBox, %average% |
|
|
| Back to top |
|
 |
RTFM. Guest
|
Posted: Sun Jul 19, 2009 6:25 pm Post subject: |
|
|
| Quote: | | I didnt knew how to make the ... | Well, next step should be to use a more meaningfull subject line for your next thread at the forum. Good luck  |
|
| Back to top |
|
 |
Matas
Joined: 07 Mar 2009 Posts: 49 Location: Europe, Lithuania
|
Posted: Wed Jul 22, 2009 4:13 pm Post subject: |
|
|
| me10c wrote: | I didnt knew how to make the
| Code: | Random, number, 12, 92
sum += %number%
}
average := sum / 100
MsgBox, %average% |
|
Now you know.  |
|
| Back to top |
|
 |
|