Skip to content

Instantly share code, notes, and snippets.

@mrmitew
Created August 5, 2018 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmitew/72269452ed496b28bac0169530038882 to your computer and use it in GitHub Desktop.
Save mrmitew/72269452ed496b28bac0169530038882 to your computer and use it in GitHub Desktop.
Get a random number that is in a given closed range
fun ClosedRange<Int>.random() = Random().nextInt(endInclusive - start) + start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment