dimanche 3 janvier 2021

How to randomly select a shape to draw several using a loop?

I got stuck when i want to display my objects in a random way . Let's say i got this pannel and let's say the rectangle and ellipse are the objects

Example

What do i need to do so i can have them display in this form.

Do i need to use Random n = new Random ? or there is another way.

This is one of my attemps but i dont know how to integrate the random function to display them.

do
{
    dr.DrawEllipse(Bpen, i + 30, 25, i + 30, 25);
    i += 50;
} 
while (i <= this.Width);



Aucun commentaire:

Enregistrer un commentaire