# Board index » delphi » filling screen with random dots - fastest algorithms?

## filling screen with random dots - fastest algorithms?

2003-09-02 08:18:11 PM
delphi39
Hi,
what are the best approaches to fill in the entire screen with "random"
dots?
I see it in some applications, but I have vague idea how it is done.
Anybody knows the internals?

## Re:filling screen with random dots - fastest algorithms?

andru123 writes:
##### Quote
Hi,
what are the best approaches to fill in the entire screen with "random"
dots?
I see it in some applications, but I have vague idea how it is done.
Anybody knows the internals?
It has been 10 years since I did graphics programming. :)
But I'd guess this is how to do it. Map each pixels to a list,
iterate through the list, and at random pick one from the list, change
the color of the pixel at the list, then delete that node from the list.
Repeat until list is empty.
I think the basic idea should be the same in Windows.
Wien.

## Re:filling screen with random dots - fastest algorithms?

"andru123" <andru123 at hotmail dot com>wrote in news:3f548a84\$1
@newsgroups.borland.com:
##### Quote
what are the best approaches to fill in the entire screen with "random"
dots?
The best solution is not to use real random numbers..... use a 32x24
portion of the screen ... making a 25x25 matrix of these squares(on a
800x600 screen for example).
Then pig a random number in 32x24 and fill it in in all 25x25 'squares -
however fill them in in a all over the place way.
TO make it look even better ... use the x,y of the 'square' to alter the
position of the random position in each square.
Becomes mostly formulaic, and you are filling in>600 dots for every
'random' calculation.
--
/* Christopher Burke - Spam Mail to XXXX@XXXXX.COM
|* www.craznar.com -
\* Real mail to c(dot)burke(at)craznar(dot)com

## Re:filling screen with random dots - fastest algorithms?

##### Quote
1) Fire up Delphi 7
2) Wait
3) After a while the bug-swarm will give you the illusion you're after

That's cruel!
Luckily, I never upgraded from D5. As long as Intraweb etc. continue to
support it I think I will stick.
Rgds,
Martin

## Re:filling screen with random dots - fastest algorithms?

Martin James writes:
##### Quote
Luckily, I never upgraded from D5.
I upgraded to Delphi 6 and am utterly satisfied.
It is a great product for me.
Now I am however going to use Delphi the RAD way, write GUI apps for Win
XP, and am curious about how that will turn out.
--
Ingvar Nilsen