I need to randomize fixed numbers, for example, 1,3,5,7,10. My output will be only 1,3,5,7 or 10. Please Help me! Thanks! Is there a way to randomize fixed numbers or user inputted numbers?
1 Answer
Get a random number from 0-4, then select from a dictionary of { 1, 3, 5, 7, 10 }.
int[] select = new int[] { 1, 3, 5, 7, 10 };
var rand = new Random();
int num = select[rand.Next(5)];
3 Comments
ChuckNorris
can i use this on string, char? :)
ChuckNorris
Sorry i am new to this, but how will my code be? What is my code?
ChuckNorris
I did it! Thanks! I can now finish my work. Thanks dbaseman! :)