Skip to content

Instantly share code, notes, and snippets.

@amonks
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save amonks/08010d21033005deb8f7 to your computer and use it in GitHub Desktop.

Select an option

Save amonks/08010d21033005deb8f7 to your computer and use it in GitHub Desktop.
int[] numbers = new int[3];
numbers[0] = 90; // Assign value to first element in the array
numbers[1] = 150; // Assign value to second element in the array
numbers[2] = 30; // Assign value to third element in the array
// Get a random element from an array
int index = int(random(numbers.length)); // Same as int(random(3))
println(numbers[index]); // Prints one of the three words
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment