# Random numbers

 william appiah-dankwah · February 25, 2015 function Car(){var Blank = 10;var Car = 9;var Bank = 3;var Base = 5;document.write(Math.random() * Blank +"," + Car +"," + Bank +"," + Base);}just wrote this code why isn't Math.random() making all the variable numbers random is there a better way of laying this out?

## Replies

 Robert Herges · February 26, 2015 Is this what you were looking for?``function Car() { var Blank = 10; var Car = 9; var Bank = 3; var Base = 5; document.write(randomize(Blank) + ", " + randomize(Car) + ", " + randomize(Bank) + ", " + randomize(Base));}function randomize(value) { return Math.random() * value;}Car();`` william appiah-dankwah · February 26, 2015 whats randomise why (Base) and (value ) why does the code work like that? yeah this is what i am trying to put together put Math.floor in to round the numbers Robert Herges · February 26, 2015 You should watch this JavaScript tutorial: https://www.thenewboston.com/videos.php?cat=10&video=16955It goes over functions and the return statement. You can reply on this thread again if you have any more questions after watching the video william appiah-dankwah · February 27, 2015 So what's value?
• 1

## Javascript

122,889 followers