Vindicator209 Posted April 16, 2009 Posted April 16, 2009 Okay so I created a simple script to sort out a list of numbers generated by itself. However, i find that the list of results has several missing numbers. Why is this? I set up msg boxes and stuff everywhere to see if it's doing something wrong, but it's not... #include <Array.au3> Dim $d[105] Dim $fin[105] For $i = 1 To 100 $d[$i] = Random(0,1000,1) Next For $k = 1 To 100 $max = 0 $CVAR = $d[$k] For $i = 1 To 100 If $CVAR > $d[$i] Then $max += 1 Next $fin[$max + 1] = $CVAR Next _ArrayDisplay($fin) Thanks [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
enaiman Posted April 16, 2009 Posted April 16, 2009 Okay so I created a simple script to sort out a list of numbers generated by itself. However, i find that the list of results has several missing numbers. Why is this? I set up msg boxes and stuff everywhere to see if it's doing something wrong, but it's not... #include <Array.au3> Dim $d[105] Dim $fin[105] For $i = 1 To 100 $d[$i] = Random(0,1000,1) Next For $k = 1 To 100 $max = 0 $CVAR = $d[$k] For $i = 1 To 100 If $CVAR > $d[$i] Then $max += 1 Next $fin[$max + 1] = $CVAR Next _ArrayDisplay($fin) Thanks The missing numbers are those generated twice or more. (ex: if you have the number 55 generated twice it will appear only once in your final list) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Vindicator209 Posted April 16, 2009 Author Posted April 16, 2009 (edited) Oh, wow, I thought I ruled that out by making it generate numbers within a larger range Thanks alot. That hurt my brain for a while. I couldn't understand how I mess up on such a small script... Edited April 16, 2009 by VindicatorOmega [center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]
enaiman Posted April 16, 2009 Posted April 16, 2009 It happens don't worry too much about it. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now