Include n in the range of choice(n)
Assisted-by: Claude Opus 5.5 via Claude Code
diff --git a/lib/minitest/thesis/test_case.rb b/lib/minitest/thesis/test_case.rb
index ebd8ad9..39fb049 100644
--- a/lib/minitest/thesis/test_case.rb
+++ b/lib/minitest/thesis/test_case.rb
@@ -24,9 +24,9 @@ module Minitest::Thesis
# Returns a number in the range [0, n]
def choice(n)
- result = make_choice(n) { @random.rand(n) }
+ result = make_choice(n) { @random.rand(n+1) }
- puts "choice(#{n}): #{result}" if should_print?
+ puts "choice(#{n}): #{result.inspect}" if should_print?
result
end
@@ -38,7 +38,7 @@ module Minitest::Thesis
else make_choice(1) { (@random.rand <= p) ? 1 : 0 }
end
- puts "weighted(#{p}): #{result}" if should_print?
+ puts "weighted(#{p}): #{result.inspect}" if should_print?
result
end
@@ -82,7 +82,7 @@ module Minitest::Thesis
@depth -= 1
end
- puts "any(#{possibility}): #{result}" if should_print?
+ puts "any(#{possibility}): #{result.inspect}" if should_print?
result
end