Simulate a Die with Given Face Probabilities

Given an n-sided die whose face probabilities are specified by probabilities, implement a reusable die simulator that returns face i + 1 with probability probabilities[i].

The original post d...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: