Re:How expensive is integer-overflow trapping in C++?
by bregma on Thursday September 24, 2020 @07:01AM
(#24577351)
Huh. That would make classic LCG PRNGs pretty useless. I guess it's "safer" in that it prevents rare dangerous edge cases at the expense of common everyday safe operations, but that's a tradeoff.
[ Parent
| on HN ]
Re:How expensive is integer-overflow trapping in C++?
by twic on Thursday September 24, 2020 @07:09AM
(#24577390)
For your LCG you would use an explicitly wrapping type: https://doc.rust-lang.org/std/num/struct.Wrapping.html