โ† PhonePe questions

Implement rand12 using rand6 with equal probability

Filed under PhonePe

The question

Given a function rand6() that returns random numbers from 1 to 6 with equal probability, implement a one-liner function rand12() using rand6() that returns random numbers from 1 to 12 with equal probability.

No write-up yet. Related questions below have one.

Related PhonePe questions

Collected from public candidate posts and coding forums. Updated Nov 2026.