x


How to use random numbers?

Alright so I just want a random number between 1 and 100. In JavaScript please. Thanks!

more ▼

asked Jan 15 '12 at 04:38 PM

Posly gravatar image

Posly
376 34 41 44

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

If you want integer numbers, use Random.Range(1, 101) - this will return integers between 1 and 100 (1 and 100 included). If you want a float, use Random.Range(1.0, 100.0) - the value returned is between 1 and 100 (both values included):

var rndNum: int = Random.Range(1, 101);

more ▼

answered Jan 15 '12 at 04:45 PM

aldonaletto gravatar image

aldonaletto
41.5k 16 42 197

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x575
x20

asked: Jan 15 '12 at 04:38 PM

Seen: 1180 times

Last Updated: Jan 15 '12 at 04:47 PM