brick / math

Arbitrary-precision arithmetic library for PHP
MIT License
1.78k stars 75 forks source link

brick/math method for gmp_random_range #46

Closed Spomky closed 3 years ago

Spomky commented 3 years ago

Hi,

Thank you for this library. It solves most of my troubles with GMP and BCMath. However in one of my projects, I use the method gmp_random_range but haven’t found any replacement here. Is there an alternative to this method?

Many thanks. Regards

BenMorel commented 3 years ago

Hi, there is no equivalent in brick/math for now, but I can definitely see a value in this. I may work on it at some point.

I'll keep this PR open as a feature request! 👍

BenMorel commented 3 years ago

Implemented as BigInteger::randomRange().

You can test it in the master branch!

BenMorel commented 3 years ago

Implemented BigInteger::randomBits() as well.

BenMorel commented 3 years ago

Released as 0.8.16! ✨