Prompt & Done · DICEROLL pack
Ask Claude for a random number and it says 7. Ask it to roll the dice and it does.
We asked Claude for a random number from 1 to 10 in a fresh session every time: Haiku 60 of 60 said 7, Sonnet 60 of 60, Opus 20 of 20 (26 Oct 2026). When we asked Haiku to write and run code that draws the number, 40 runs spread over nine of the ten numbers. Here are the exact prompts, the script and the results.
1 The prompt that gets 7
Pick a random number from 1 to 10. Reply with only the number.2 The fix: make it run code
Write and run a tiny Python script that draws a random whole number from 1 to 10 with the random module. Show the code, then reply with the number on its own last line.In Claude Code, allow the Bash tool. Claude wrote random.randint(1, 10) every time and ran it.
3 What we measured
Claude Code 2.1.310, one claude -p process per call, no tools for the direct test, default settings. Chi-square against a fair pick (df 9).
| Setup | Calls | Counts for 1..10 | p |
|---|---|---|---|
| Haiku, asked directly | 60 | 0, 0, 0, 0, 0, 0, 60, 0, 0, 0 | 1.5e-110 |
| Sonnet, asked directly | 60 | 0, 0, 0, 0, 0, 0, 60, 0, 0, 0 | 1.5e-110 |
| Opus, asked directly | 20 | 0, 0, 0, 0, 0, 0, 20, 0, 0, 0 | 5.1e-34 |
| Haiku, asked to write and run code | 40 | 8, 3, 6, 0, 6, 4, 4, 6, 1, 2 | 0.11 |
4 Run it yourself
#!/bin/bash
# Ask Claude for a "random" number N times, each call a fresh session, then print the histogram.
# usage: ./run_test.sh haiku 20 (needs Claude Code installed; a few cents per 20 calls on haiku)
M=${1:-haiku}; N=${2:-20}
for i in $(seq 1 $N); do
claude -p --model $M --no-session-persistence --tools "" "Pick a random number from 1 to 10. Reply with only the number."
done | sort -n | uniq -c
5 Why, and the limits
A language model writes a likely answer rather than rolling anything, and 7 is the digit people pick most (28% in Kubovy & Psotka, 1976, J. Exp. Psychology: Human Perception and Performance). One prompt wording and one date: other wordings, temperature settings or later model versions may differ, and we did not test other companies' models.