Generate 0 and 1 with 25% and 75% probability

Given a function that generates 0, 1 50% of the time (like most of the random function in modern programming languages do), how can we design a function that return 0, 1 25%, 75% of the time?

Let's lay out a rule: random functions that return floating points are not allowed to be used. One can only use the said function that returns 0, 1 in equal probability since one can easily set a floating point as a threshold and return 0, 1 according to the exceedance threshold values.

📚ContentMaths and ...
 •  0 comments  •  flag
Share on Twitter
Published on May 26, 2022 07:02
No comments have been added yet.