@@ -1006,7 +1006,7 @@ def sample(count=undefined, options=undefined)
1006
1006
end
1007
1007
end
1008
1008
1009
- def sample_many ( count , rng )
1009
+ private def sample_many ( count , rng )
1010
1010
if count <= 70 # three implementations; choice determined experimentally
1011
1011
if 2.0 * size / count <= count + 13
1012
1012
sample_many_swap ( count , rng )
@@ -1021,19 +1021,18 @@ def sample_many(count, rng)
1021
1021
end
1022
1022
end
1023
1023
end
1024
- private :sample_many
1025
1024
1026
- def sample_many_swap ( count , rng )
1027
- #linear dependence on array size, therefore very slow for small count / size
1025
+ private def sample_many_swap ( count , rng )
1026
+ # linear dependence on array size, therefore very slow for small count / size
1028
1027
result = Array . new ( self )
1029
1028
1030
1029
count . times do |c |
1031
1030
result . __send__ :swap , c , rng . rand ( size )
1032
1031
end
1033
1032
end
1034
1033
1035
- def sample_many_quad ( count , rng )
1036
- #quadratic time due to linear time collision check but low overhead
1034
+ private def sample_many_quad ( count , rng )
1035
+ # quadratic time due to linear time collision check but low overhead
1037
1036
result = Array . new count
1038
1037
i = 1
1039
1038
@@ -1075,7 +1074,7 @@ def sample_many_quad(count, rng)
1075
1074
result
1076
1075
end
1077
1076
1078
- def sample_many_hash ( count , rng )
1077
+ private def sample_many_hash ( count , rng )
1079
1078
# use hash for constant time collision check but higher overhead
1080
1079
result = Array . new count
1081
1080
i = 1
@@ -1117,7 +1116,6 @@ def select!(&block)
1117
1116
ary = select ( &block )
1118
1117
Primitive . steal_array_storage ( self , ary ) unless size == ary . size
1119
1118
end
1120
-
1121
1119
alias_method :filter! , :select!
1122
1120
1123
1121
def shuffle ( options = undefined )
@@ -1226,7 +1224,6 @@ def unshift(*values)
1226
1224
1227
1225
self
1228
1226
end
1229
-
1230
1227
alias_method :prepend , :unshift
1231
1228
1232
1229
def values_at ( *args )
0 commit comments