By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,039 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,039 IT Pros & Developers. It's quick & easy.

Randomly shuffle a list

P: 1
Hi all,

I am new, to this forum and also to VB.Net and I encountered a problem. I need an array that contains 100 random numbers, between 1 and 100. More specifically, the array must contain all the numbers between 1 and 100, but in random order, and I don't know how to do that. Any help would be appreciated.

Thank you.
Sep 22 '07 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 8,434
One way would be to loop from 1 to 100 and copy each value a randomly-chosen position position in the array. The trick is to keep randomly choosing the position until you find one that contains zero. The most likely way to achieve this is probably with something like a Do loop nested inside a For loop.
Sep 22 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.