User enters numbers to 10 textbox and i sent them to an array. Now i want to generate random numbers from this array. What can i do?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like this:
Usage:
Or do you want to shuffle the array?
[Edit]
To shuffle the array, you can use the Fisher–Yates shuffle shown in this post:
If you want the interface to be same as the
Randomizerclass above, you can modify it to use theShufflerclass:Note that the code is not thread safe, so some locking should be implemented if
Nextmethod might be called simultaneously from multiple threads.