Amazon Interview Question

coding question about weighted random number generator