RNG is a bit funky and I don’t really get how it works, just that it does. Here are some referenced examples from their docs.
:- %say
|= [[* eny=@uvJ *] *]
:- %noun
^- tape
=/ answers=(list tape)
:~ "It is certain."
"It is decidedly so."
"Without a doubt."
"Yes - definitely."
"You may rely on it."
"As I see it, yes."
"Most likely."
"Outlook good."
"Yes."
"Signs point to yes."
"Reply hazy, try again"
"Ask again later."
"Better not tell you now."
"Cannot predict now."
"Concentrate and ask again."
"Don't count on it."
"My reply is no."
"My sources say no."
"Outlook not so good."
"Very doubtful."
==
=/ rng ~(. og eny)
=/ val (rad:rng (lent answers))
(snag val answers)
|= [[* eny=@uvJ *] *]
Give the generator access to eny
which is a source of randomness
=/ answers=(list tape)
:~ "Value 1"
"Value 2"
==
Using :~
create a null terminated list
=/ rng ~(. og eny)
Load ++og
and instantiate it with our current entropy seed eny
. Save this into the variable rng
=/ val (rad:rng (lent answers))
Set val
to a random number between 0
and the length of answers
(snag val answers)
Get the element at index val