I think
Float randomFrom: -4.1 to: 2.5
or
Float randomBetween: -4.1 and: 2.5
would be the most descriptive and compliant to your signature ;-)
An interval does not necessarily contain Floats.
Going to the class side of Float makes sense because you create a new instance.
On 16 Apr 2018, at 11:51, Serge Stinckwich <serge.stinckwich@gmail.com> wrote:
Hi Pharoers,
some random musings about Random numbers :-)
In the context of the CORMAS project:
http://cormas.cirad.fr/indexeng.htm
I would like to propose an API for manipulating random numbers
to users who are not developers but modelers of complex systems.
In CORMAS, people need to generate a lot of random numbers for simulation for exemple. For example, you can do:
Cormas randomFloatFrom: -4.1 to: 2.5
���At the moment, there is no Pharo API to generate with a one-liner a random float number between two values for example.
You can do this for integers: 10 atRandom to generate an integer between 1 to 10.
There is atRandom defined on Interval, so can you say :
(2.3 to: 4.5) atRandom
but it will not generate a random float numbers between 2.3 and 4.5
but numbers like: 2.3, 3.3 or 4.3.
because Interval are considered as a Collection.
���Any comments about that ?
How we can enhance the situation ?���
Any interest to introduce a method to produce random float numbers in an interval in Pharo ?
���Thank you���
--
Serge Stinckwich
UMI UMMISCO 209 (SU/IRD/UY1)
"Programs must be written for people to read, and only incidentally for machines to execute."
http://www.doesnotunderstand.org/