I am attempting to simulate a dice roll using the RANDOM class in the BASE library. With my current code, it only ever prints out 5.
class
APPLICATION
create
make
feature
make
local
random_obj: RANDOM
do
create random_obj.make
io.put_integer (random_obj.next_random (random_obj.item) \\ 6 + 1)
end
end
You're always using the default seed. You need to set a different seed on each run.
The current time in seconds as an
INTEGER_32
is a good option for a seed that will be different on each run.