Given a set of request types and their counts such as below. Design a class and method random() which returns the request type such as 1,2 etc.
Request Type Count
1 200
2 4000
3 10
......
N 6210
constraints
1. The distribution should not exceed any ratio count such as request1's count : request2's count = 200 : 4000 (1:20)
2. Similarly for others such as req 1 : req3 (200 ; 10) = 20 : 1
3. The random() function could be called 1M times.Follow up : Write unit tests