Skip to content

Randomization

Mission Peace edited this page Apr 3, 2016 · 1 revision
  1. Given a method to generate random number between 1 to 5, create a new method to generate random number between 1 to 7 - Rand7UsingRand5.java
  2. Given a list of countries with population, how do you select random country from this list. Higher the population higher the probability of selection - RandomCountrySelectionByPopluation.java
  3. Reservior sampling algorithm. In stream of numbers select k random numbers - SelectMRandomNumbersInStream.java
  4. Given an array shuffle it - ShuffleArray.java
Clone this wiki locally