Class: String
Constant Summary
collapse
- @@min_range =
0
- @@max_range =
1024
Class Method Summary
collapse
Instance Method Summary
collapse
arbitrary
random, random_array, random_std
Class Method Details
.arbitrary ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/rushcheck/string.rb', line 20
def self.arbitrary
RushCheck::Gen.sized do |n|
RushCheck::Gen.unit((0..n).map{rand(128).chr}.join)
end
end
|
.bound ⇒ Object
30
31
32
|
# File 'lib/rushcheck/string.rb', line 30
def self.bound
[@@min_range, @@max_range]
end
|
.random_range(gen, lo = @@min_range, hi = @@max_range) ⇒ Object
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/rushcheck/string.rb', line 34
def self.random_range(gen, lo=@@min_range, hi=@@max_range)
len, g = Integer.random(gen, lo, hi)
result = ''
len.times do
v, g = Integer.random(g, 0, 127)
result += v.chr
end
[result. g]
end
|
Instance Method Details
#coarbitrary(g) ⇒ Object
45
46
47
48
49
50
51
|
# File 'lib/rushcheck/string.rb', line 45
def coarbitrary(g)
r = g.variant(0)
each_byte do |c|
r = c.coarbitrary(r.variant(1))
end
r
end
|