Include n in the range of choice(n)
Assisted-by: Claude Opus 5.5 via Claude Code
change yqrkskopownnoztzlmzrrntwvnpzplvy
commit 7cfde948ecbefcbd2e0c7c5832b9b84748dfb0c0
author Alpha Chen <alpha@kejadlen.dev>
date
parent 15ee1808
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