Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
How do I generate a random whole number via scripting?
If you want to use js, use the Browser object, or scripting, if you have that feature.
There's also the Advanced Random object if you need more advanced features, seed, noise, etc.
Thank you for the reply. int(random(n)) gave me the same error that everything else that I tried did. That it is not defined.
I wrote this piece of script in the script.js file that is created inside the editor.
What am I doing wrong?
Maybe try leaving the int() off.
Thanks for the help.
Develop games in your browser. Powerful, performant & highly capable.
Math.floor(Math.random() * 100)