The standard meaning of ".roll" is to randomly select elements 
from a list.  So I'd expect .roll on a Range to first convert the
Range to a list of values and then select from those.

If the intent is to select from the values 0.1, 0.2, 0.3, I'd expect
the programmer to write:

   (0.1, 0.2, 0.3).roll(6)

If the intent is to select from a range of values incrementing by 
0.1, then:

   (0.1, 0.2 ... 10.1).roll(6)

If the intent is to generate six random Num values from a Range,
then it should probably be (I suspect this isn't implemented yet):

   (0.1 .. 0.3).rand xx 6

Pm


On Thu, Nov 26, 2015 at 03:36:49PM +0100, Wenzel P. P. Peppmeyer wrote:
> 
> On Thu, 26 Nov 2015, Elizabeth Mattijsen via RT wrote:
> 
> >>(0.1 .. 0.3).roll(10).say;
> 
> >What did you expect?  a selection of 0.1, 0.2, 0.3 ??  or 10 random values 
> >between 0.1 and 0.3 inclusive?
> 
> I would (naive) expect 10x a value between 0.1 and 0.3 . Analog to:
> 
> (0.1, 0.2, 0.3).roll(10).say;
> # OUTPUT«(0.3 0.2 0.1 0.2 0.1 0.2 0.3 0.2 0.2 0.1)␤»
> 
> However, S03 is quite clear how Range is iterating.
> 
> 0.1.succ == 1.1;
> 
> So incrementing by 0.1 can't work. It may be reasonable to fail as early as
> possible for Range.roll on any Range that is neither Int nor Str on both end
> points.
> 
> mfgwp

Reply via email to