Short answer
No. With ZSH_THEME="random", current oh-my-zsh makes an independent draw at every shell startup. Nothing is persisted between sessions, so the theme you saw last time has no influence on the next draw, and there is no documented option that turns on repeat avoidance. Seeing the same theme twice in a row is expected behavior, not a bug.
What the startup path actually does
When oh-my-zsh is sourced, it resolves ZSH_THEME. If the value is random, it calls an internal helper in lib/theme-functions.zsh (named _oh_my_zsh_random_theme in recent releases) that picks one file from the themes directory and assigns the chosen name back to ZSH_THEME. The pick happens once per shell process. There is no lock file, no "last used" record, and no cross-session seed.
This describes recent releases (roughly 2023 onward). The file path and helper name have been stable, but verify against your own checkout before relying on the details.
The two selection paths
- External
shuf available: the helper pipes the theme list through shuf -n 1. That is a uniform draw over the candidate list, with no memory of previous runs.
shuf unavailable: the helper falls back to the shell's $RANDOM built-in, typically indexing into an array of theme names. $RANDOM yields integers in 0–32767 and is seeded automatically by the shell at process start.
Practically, the difference matters less than it sounds. oh-my-zsh ships on the order of a hundred-plus themes, far below 32768, so any modulo bias from the fallback is negligible. The real limitation is the same on both paths: independence, not uniformity. The fallback also means two machines can behave differently for reasons unrelated to your configuration.
What is configurable
Recent versions expose options that shape the pool, not the repeat behavior:
ZSH_THEME_RANDOM_CANDIDATES restricts the draw to a list you supply.
ZSH_THEME_RANDOM_QUIET suppresses the notice printed when a random theme is loaded.
Neither prevents a repeat. Narrowing the candidate list actually raises the chance of one, since the pool is smaller. Confirm both options exist in your checkout before relying on them — they are absent from very old versions.
Verifying on your own copy
# 1. Confirm the helper and which branch it takes
grep -n -A 30 '_oh_my_zsh_random_theme' "${ZSH:-$HOME/.oh-my-zsh}/lib/theme-functions.zsh"
# 2. Is shuf present?
command -v shuf
# 3. How large is the candidate pool?
ls "${ZSH:-$HOME/.oh-my-zsh}/themes" | wc -l
To observe repeats, sample the resolved theme across fresh shells. This assumes your version writes the chosen name back to ZSH_THEME — check the helper body first:
for i in $(seq 1 20); do
zsh -ic 'print -r -- $ZSH_THEME' 2>/dev/null
done | sort | uniq -c
With roughly N themes and uniform selection, the chance that two consecutive startups match is about 1/N. For a pool of ~140 themes that is under 1% per pair, so a repeat within a handful of sessions is uncommon but entirely normal.
If you need rotation rather than randomness
oh-my-zsh does not provide it. The workable approach is to choose the theme yourself before sourcing oh-my-zsh.sh: read the previous pick from a small state file, exclude it from the candidate array, draw from the rest, then write the new pick back. Doing it before sourcing avoids fighting the helper, which assigns ZSH_THEME during startup. This is custom logic you own and test; treat any snippet you find online as a sketch, not a supported feature.
One detail that changes the recommendation
Do you want statistical randomness, or guaranteed non-repeating rotation? If it is the former, the stock behavior is already correct and you only need to accept occasional repeats. If it is the latter, the state-file approach above is the right shape, and no documented oh-my-zsh option will get you there.