AutoHotkey Community

It is currently May 26th, 2012, 8:17 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: I need a simple code
PostPosted: July 18th, 2009, 7:13 pm 
Offline

Joined: November 22nd, 2008, 9:52 pm
Posts: 44
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2009, 7:19 pm 
Offline

Joined: March 7th, 2009, 6:44 pm
Posts: 49
Location: Europe, Lithuania
Your English is awful.. Can't understand what u want :lol:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2009, 7:22 pm 
Offline

Joined: November 22nd, 2008, 9:52 pm
Posts: 44
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2009, 7:57 pm 
Offline

Joined: March 7th, 2009, 6:44 pm
Posts: 49
Location: Europe, Lithuania
here u are, lazy guy.. :D

Code:
loop, 100
{
Random, chance, 1, 100
if chance > 80
Number = 0
Else
Random, number, 12, 92
sum += %number%
}

average := sum / 100
MsgBox, %average%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 18th, 2009, 8:36 pm 
Offline

Joined: November 22nd, 2008, 9:52 pm
Posts: 44
I didnt knew how to make the
Code:
Random, number, 12, 92
sum += %number%
}

average := sum / 100
MsgBox, %average%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2009, 7:25 pm 
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 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 22nd, 2009, 5:13 pm 
Offline

Joined: March 7th, 2009, 6:44 pm
Posts: 49
Location: Europe, Lithuania
me10c wrote:
I didnt knew how to make the
Code:
Random, number, 12, 92
sum += %number%
}

average := sum / 100
MsgBox, %average%


Now you know. :)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, SifJar, SKAN, StepO and 59 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group