I am having trouble writing a loop that will check to see if a random number exists in an array and was looking to get some help.
Let me Elaborate
I have a function that returns a random (integer) number between a range called GetRandom()
I want to execute GetRandom() and then check to see if MyArray() contains the new number, if it does not contain the number then I want to add it to the array, if it does contain the array then i need to run GetRandom() again until it doesn't contain the number.
My brain is getting confused on how to determine whether to throw the number out or add it to the array. I'm sure this is a stupid simple problem but I'm stuck.
I appreciate the help. Thanks.
Let me Elaborate
I have a function that returns a random (integer) number between a range called GetRandom()
I want to execute GetRandom() and then check to see if MyArray() contains the new number, if it does not contain the number then I want to add it to the array, if it does contain the array then i need to run GetRandom() again until it doesn't contain the number.
My brain is getting confused on how to determine whether to throw the number out or add it to the array. I'm sure this is a stupid simple problem but I'm stuck.
I appreciate the help. Thanks.