Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I have 52 image files and I have 5 places that have to be filled. Is there a way to place a random image in each place? Is there a way to create a loop that will be able to run through all the places and placing images in all of them.
Posted

How about using a random number and mod/remainder of the random number divided by 5.

 

//in c#, will generate a number between 0 and 4.

int value = new Random().Next()%5;

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...