Truly Random Numbers: Difference between revisions

From Goodblox Wiki
Jump to navigationJump to search
(Created page with "{{CatUp|Tutorials}} __TOC__ == Introduction == This tutorial covers random numbers. == Random number generator == The random number generator in Goodblox generates random...")
 
mNo edit summary
 
Line 8: Line 8:
== Random number generator ==
== Random number generator ==


The random number generator in Goodblox generates random numbers.  
The random number generator in GoodBlox generates random numbers.  


* Start [[Goodblox Studio]].
* Start [[GoodBlox Studio]].
* Insert > Object > Script.
* Insert > Object > Script.
* Copy and Paste the following script into the newly created Script Object:
* Copy and Paste the following script into the newly created Script Object:

Latest revision as of 03:10, 28 September 2021

Introduction

This tutorial covers random numbers.

Random number generator

The random number generator in GoodBlox generates random numbers.

  • Start GoodBlox Studio.
  • Insert > Object > Script.
  • Copy and Paste the following script into the newly created Script Object:
for i = 1, 10 do -- this will create a loop which will run 10 times
print(math.random(1,100)) -- this will print random number from 1 to 100
wait(1) -- this will wait 1 second
end -- end of the loop

If math.random() was used, any number would appear.

See Also

Random Number Generator