Learn Create Your Own Split Screen

Next Page

You spend a fairly large part of your school career coming up with exact answers to specific questions, so it's somewhat ironic to find that random numbers are so useful in game software.

You've doubtless made good use of this Scratch block.

Javascript has a similar feature, but it always returns a random number which is somewhere between zero and one (including zero, but excluding one). You use it like this:

var thing = Math.random();
After this line of code, the 'thing' variable might contain values similar to the following:

       0.19287346  
       0.5243 
       0.993873 
       0.00003873 
It might even be zero, but it will never be exactly one.