develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35893 - trunk/languages/perl6/src/classes

From:
coke
Date:
January 22, 2009 09:47
Subject:
[svn:parrot] r35893 - trunk/languages/perl6/src/classes
Message ID:
20090122174737.EFDC1CB9AE@x12.develooper.com
Author: coke
Date: Thu Jan 22 09:47:37 2009
New Revision: 35893

Modified:
   trunk/languages/perl6/src/classes/Range.pir

Log:
Revert add of Range.pick; while the no argument version here does better for
the simple case of (1..10000000).pick; it fails to handle other variants, causing
spec test regressions.



Modified: trunk/languages/perl6/src/classes/Range.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Range.pir	(original)
+++ trunk/languages/perl6/src/classes/Range.pir	Thu Jan 22 09:47:37 2009
@@ -72,30 +72,6 @@
      .return ($P0)
 .end
 
-=item pick
-
-Select an element at random from the range.
-
-=cut
-
-.sub 'pick' :method
-    .local pmc result, rand
-    rand = get_hll_global ['Any'], '$!random'
-
-    .local int from,to,diff,result
-    from = self.'from'()
-    to = self.'to'()
-    diff = to - from
-
-    $N0 = rand
-    $N0 *= diff
-
-    result = $N0
-    result += from
-
-    .return (result)
-.end
-
 =item from()
 
 =item to()



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About