Java Arena

Module 46

Random numbers

Random numbers. The class Random and nextInt with a bound, shifting a range such as 1 to 6, seeds and why the same seed gives the same numbers, classes that take a Random so they can be tested, nextDouble, nextBoolean and Math.random() for decimal numbers and chances, picking a random element, shuffling and drawing without repeats, and simulations and checks for programs whose results are random. MOOC section 12.3.

Steps

  1. Random and nextInt
  2. Seeds: the same numbers every time
  3. Decimal numbers and chances
  4. Picking, shuffling and drawing
  5. Simulations, and checking random results