MCPcopy Create free account
hub / github.com/careercup/ctci / rand

Method rand

java/Chapter 18/Question18_2/Question.java:8–10  ·  view source on GitHub ↗
(int lower, int higher)

Source from the content-addressed store, hash-verified

6
7 /* Random number between lower and higher, inclusive */
8 public static int rand(int lower, int higher) {
9 return lower + (int)(Math.random() * (higher - lower + 1));
10 }
11
12 public static int[] shuffleArrayRecursively(int[] cards, int i) {
13 if (i == 0) {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected