Computer Science Canada Randomizing an exact amount on the screen |
Author: | agnivohneb [ Wed Sep 05, 2007 6:34 pm ] |
Post subject: | Randomizing an exact amount on the screen |
I want to place a specific number of dots (example 6) in a 15 by 15 pixel area I want to randomize the output so the dots so up in a different spot every time. Any help I am not that good with math. If you need any more info just ask. |
Author: | Clayton [ Wed Sep 05, 2007 6:48 pm ] |
Post subject: | RE:Randomizing an exact amount on the screen |
Think about this logically... Really, problem solving is one of the most important aspects of Computer Science. Break your big problem down into smaller problems. 1)You need to draw a dot randomly 2)You need to section off a 15 x 15 pixel area on the screen 3)The dot needs to appear in this area 4)Repeat 1) - 3) five more times |
Author: | Nick [ Wed Sep 05, 2007 10:05 pm ] |
Post subject: | RE:Randomizing an exact amount on the screen |
well what i'd do is make an x and y varible for the dot's location then use randint to randomize where it goes and use randint to limit where the dots can go |
Author: | d2bb [ Thu Sep 06, 2007 7:42 am ] |
Post subject: | RE:Randomizing an exact amount on the screen |
not even sure his question made to much sense, but just make a program to draw random x + y values inbetween 1-whatever our screen size is. After this use a counted-loop it and you should be good. |
Author: | agnivohneb [ Fri Sep 07, 2007 10:11 pm ] | ||
Post subject: | Re: Randomizing an exact amount on the screen | ||
I figured it out
I only set num to a random number for now i will change it later to use a specific number. I'm on the right track now. I think. |
Author: | Nick [ Fri Sep 07, 2007 11:06 pm ] | ||
Post subject: | RE:Randomizing an exact amount on the screen | ||
you looking for something like this?
what u did was go WAY to indepth for something pretty simple |
Author: | agnivohneb [ Fri Sep 07, 2007 11:19 pm ] |
Post subject: | RE:Randomizing an exact amount on the screen |
That is the same thing I had only I expanded it to more 15x15 boxes there are 15x15 boxes = 225 pixels up and 225 pixels over each individual box is a unique number and when i release the program next week you will see were I'm going with this. |
Author: | Nick [ Sat Sep 08, 2007 11:28 am ] |
Post subject: | RE:Randomizing an exact amount on the screen |
oh i get it i still dont get where ur going but i assume both ways would work for my way just make my for loop inside 2 others and have those 2 for loops equal the x and y inside the Rand.Int... when i get less lazy ill show u |