How to calculate variables from one method inside another method: Help!!! (Complicated)
Hi everyone, This complicated plan I have is driving me nuts so I'd really appreciate if one of you superior coders could help me with this. I want the following: The main method and it's class include an array: AnimalList[] = { "frog", "dog", "rabbit", "donkey", "cow", "chicken" }; HumanList[] = { "man", "woman", "child", "grandpa", "grandma", "baby" }; ...3 Animals: String Animal1; String Animal2; String Animal3; ...and 3 Humans: String Human1; String Human2; I want to create one method, that randomly picks 3 of the array entries, compares them with the other picks to avoid duplication and than sends them back to main. Something like: for (Animal1 = AnimalList[(byte)(Math.random()*AnimalList.length), Animal2 = AnimalList[(byte)(Math.random()*AnimalList.length), Animal3 = AnimalList[(byte)(Math.random()*AnimalList.length)]; Animal1 == Animal2 || Animal1 == Animal3 || Animal 2 == Animal 3 ; Animal2 = AnimalList[(byte)(Math.random()*AnimalList.length), Animal3 = AnimalList[(byte)(Math.random()*AnimalList.length)] ); I want this to work for any other list aswell so that I can basically sent humans and the humanslist (automatically including it in .length aswell) in there so I save a lot of space in my code and it looks better sorted. In case one of you shows me how to do this... THANK YOU!!!