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

ssh - Vagrant Windows - ssh_exchange_identification: read: Connection reset by peer -

gcc - Neither ld wrap nor LD_PRELOAD working to intercept system call -

maven - jacoco coverage per test setup -