Part I. The language · this page as markdown
Chance that repeats
A fortune jar that always gives the same fortune isn't much of a jar. Plazmi Lisp has words for chance: a number from a range, an item from a list, a list shuffled. Its chance has one property worth understanding before you use it: it repeats.
The words #
(rand-int 6)
(rand-nth ["moss" "rose" "sage"])
(shuffle [1 2 3 4 5])
(rand)
(pick-one ["Hello!" "Hi there."])…
"…"
[…]
0.…
"…"(rand-int n)is a whole number from 0 up to, not including,n. For a die,(inc (rand-int 6))is 1 to 6.(rand-nth l)is one item of a list;pick-oneis the same, and answersnilfor an empty list whererand-nthwould stop.(shuffle l)is the list in an order of chance.(rand)is a decimal from 0 up to 1.(random-sample p l)keeps each item with chancep.
The book writes … for these answers, because they are chance. What they can't be is anything else: (rand-int 6) is always one of 0 to 5.
Where the chance comes from #
Every run of a plan, and every time a toy is played, starts its chance from a seed: a number made from who is running it and how far along the world's history is. From the same seed, the words give the same answers in the same order.
Send the same plan twice, with nothing happening in the world between, and it answers the same:
[(rand-int 100) (rand-int 100) (rand-int 100)][… … …][(rand-int 100) (rand-int 100) (rand-int 100)][… … …]Within one run the three numbers differ from each other, because each call moves on to the next. Sent again, the same three come back. (A plan that only works something out changes nothing in the world, so the world hasn't moved on.) Once something happens, a visit, a toy played, a change at home, the seed is new and so are the answers.
Why it repeats #
A run depends on nothing but what it is given: the program, the world as it stands, and its seed. There is no hidden source of chance and no clock outside the world. So any run can be done again and give the same result. Plazmi relies on that: when a toy is written again in a new form, its old and new versions can be run side by side, from the same state with the same seed, and compared step by step. It also means a toy can't behave one way when you test it and another when nobody's looking.
For you, it means two things. Chance in a plan is for variety, not for secrets: anyone who knows the world as it stood could work out what it picked. And sending a plan again to "reroll" gives the same result until the world moves on.
Chance in a toy #
A toy's seed is made from its maker, the toy and the world's place in its history, so each play is a fresh roll. Here is a die:
(defobject die
{:name "Die"
:verbs {:roll (fn [self who]
(say self (str "It lands on " (inc (rand-int 6)) ".")))}})> roll die
[Juniper's die] It lands on ….
> roll die
[Juniper's die] It lands on ….And a fortune jar that picks a line:
(defobject fortune-jar
{:name "Fortune jar"
:verbs {:open (fn [self who]
(say self (rand-nth ["A small kindness goes a long way round."
"There's room in the day for something new."
"Someone is thinking of you kindly."])))}})> open fortune jar
[Juniper's fortune jar] …Chance without repeats #
rand-nth can pick the same line twice running. When that would feel wrong, keep a count in the toy's state and step through a list in turn, or shuffle once and keep the order. Chapter 9 shows how a toy keeps a count; the pattern is (nth lines (mod turn (count lines))):
(let [lines ["one" "two" "three"]]
(map (fn [turn] (nth lines (mod turn (count lines)))) (range 5)))("one" "two" "three" "one" "two")Try it #
- Answer the total of three dice, each
(inc (rand-int 6)). - Answer a shuffled list of the days of the week.
- Why might two residents sending the same
(rand-int 100)at the same moment get different answers? - Write a coin toy whose verb
flipsays "Heads." or "Tails.".
Recap #
rand-int,rand-nth,pick-one,shuffle,randandrandom-samplegive chance.- Each run's chance comes from a seed made from who runs it and the world's place in its history: the same seed, the same answers.
- So a run can always be repeated exactly. Chance is for variety, not secrets.
- Each play of a toy is a fresh roll.
Next: reading your own home.
Written by Claude, Plazmi's writer, for Plazmi, a service of Manatee Media LLC. Text © 2026 Manatee Media LLC. The examples are free to copy, change and run.