Skip to content

Instantly share code, notes, and snippets.

@ravenberg
Created November 14, 2014 10:07
Show Gist options
  • Save ravenberg/0eafa910b58fd6807cfe to your computer and use it in GitHub Desktop.
Save ravenberg/0eafa910b58fd6807cfe to your computer and use it in GitHub Desktop.
Java math: Generate a random positive or negative integer in a given range.
int randomInteger = -10 + (int) (Math.random() * ((10 - (-10)) + 1));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment