Skip to content

Commit c3e251d

Browse files
committed
Add Range.rand
1 parent 1b64539 commit c3e251d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doc/Type/Range.pod6

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,17 @@ L«C<.excludes-max>|/type/Range#method_excludes-max»,
309309
L«C<.infinite>|/type/Range#method_infinite», and
310310
L«C<.is-int>|/type/Range#method_is-int» as named arguments.
311311
312+
=head2 method rand
313+
314+
Defined as:
315+
316+
method rand(Range:D --> Num:D)
317+
318+
Returns a pseudo-random value belongs to the range.
319+
320+
say (1^..5).rand; # OUTPUT: «1.02405550417031␤»
321+
say (0.1..0.3).rand; # OUTPUT: «0.2130353370062␤»
322+
312323
=end pod
313324

314325
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)