I cant seem to generate a random number using MODULE cerberus.random


New Member
Aug 3, 2018
I don't know how to generate a random number here. I've only used python before and Cerberus X feels very different and I can't get my head around some of the simple stuff. Can someone help me with this pls. I only get 0,1,3 as a result

Global Seed:Int

Function Main()


Local asd:Float = Int(Rnd())

Local baz:Float = Int(Rnd(5.0))

Local foo:Float = Int(Rnd(0.0,5.0))

Print asd

Print baz

Print foo



Active Member
3rd Party Module Dev
3rd Party Tool Dev
Mar 5, 2018
Could you tell me the problem. All random number look good.
You don't need to declare a 'Global Seed:Int'. It will override internal global.


3rd Party Module Dev
Jul 31, 2017
Bern, Switzerland
The pseudo random number generator generates a sequence of numbers based on the seed value. This means, if you set seed to the same value at every start up of your program, it will generate the same sequence every time.

A very common way to set the seed is writing
Local date := GetDate()
Seed = date[3] * 3600000 + date[4] * 60000 + date[5] * 1000 + date[6]
This way, you will see different results every time you run your code.


New Member
Aug 3, 2018
Oh I get it now. I've only used python before so the idea of using a seed when generating a value is very new to me.


New Member
Aug 25, 2017
Python does seeding by the time automatically, but you can do random.seed() to set it manually.

Fixed seeds are useful for doing procedural generation; since you always get the same numbers back from the seed in order, you can basically store a whole level (or other procedurally generated thing) with just the seed number.
Top Bottom