note
LanX
<c>@array[0 ..0]</c> is one and not zero elements!<P>
<C>
DB<103> @array=a..f
=> ("a", "b", "c", "d", "e", "f")
DB<104> @array[0..0]
=> "a"
</c><P>
<b>UPDATE:</b><P>
your statistical proof falls into the trap <P>
<c>scalar @array != scalar (LIST)</c><P>
if your <c>function()</c> returns a one element list <c>(0)</c>, then <c>scalar function()</c> will be 0, since 0 is the last element of the list.<P>
(more detailed in [id://1007707] by [eyepopslikeamosquito] )<P>
initializing <c>@array = 1..10</c> makes it more obvious, b/c the last element of a sublist is now identical to the length! <P>
<c>
DB<106> @array = 1 .. 10;
=> (1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
DB<107> sub x{ return @array[ 0 .. int( rand @array ) ]; };
=> 0
DB<108> $stats{ scalar( x() ) }++ for 1 .. 1000;
=> ""
DB<109> \%stats;
=> { 1 => 100, 2 => 101, 3 => 108, 4 => 108, 5 => 101, 6 => 103, 7 => 79, 8 => 98, 9 => 100, 10 => 102 }
</c><P>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-708738">
<p>Cheers Rolf
</div></div>
1007684
1007687