Random bool

20 views
Skip to first unread message

Jason Gade

unread,
May 4, 2026, 8:35:42 PM (5 hours ago) May 4
to golang-nuts
math/rand and math/rand/V2 have functions that return various int and float types, but no function that returns a bool. While this would be very easy to implement on our own, I think it's an oversight for the packages.

rand.Bool() could represent a coin flip, which is a very common need in random value generation and modeling.
Reply all
Reply to author
Forward
0 new messages