arrays - I need to determine if a random number is unique -


i need write function receives number generated in fillarray , determine if has been generated. need return true or false determining if random number must put array. here's working on. help. i've searched similar unfortunately cannot find anything.

public class randomgenerator {

int arr[] = new int[6]; int size;  public void fillarray() {     int randnum = (int) (math.random() * 49) + 1;     (int = 0; < size; i++) {          arr[i] = randnum;         alreadythere(randnum);       }     size++; }  public int alreadythere(int randnum) {     int find = randnum;     boolean found = false;     int = 0;     while (!found && < size) {         if (arr[i] == find) {             found = true;         }         i++;     }     if (!found) {     }     return randnum; } 


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -