Where are my glasses?
Gender:
Posts: 20
166 credits Members referred : 0
« Reply #2 on: Aug 28, 2008, 02:02:37 pm »
please tell me the javascript code to generate the even numbers.
My name is Bong, James Bong
Posts: 11
80 credits Members referred : 0
« Reply #3 on: Apr 18, 2009, 01:31:13 pm »
Multiply any number with 2 and you get your even numbers !!!
Code:
Math.floor(Math.random()*5 * 2 )
Cyberpunk Wannabe
Posts: 38
228 credits Members referred : 0
« Reply #4 on: Jul 27, 2009, 05:35:48 pm »
boy. you guys are the masters!
Hunky Junky Monky Man!
Posts: 66
652 credits Members referred : 0
« Reply #5 on: Oct 12, 2009, 10:44:10 pm »
I really like these tricks. Every thing is possible in java script.
Atari ST fan
Posts: 7
42 credits Members referred : 0
« Reply #6 on: Nov 22, 2010, 07:31:03 am »
Such a this java script is very powerful so i am always use that,,,, so thanks for this...
What a dork
Posts: 17
102 credits Members referred : 0
« Reply #7 on: Mar 22, 2011, 06:15:27 pm »
The results may be unpredictable, but the technique to getting them certainly is not. To generate a random number in JavaScript, simply use the following code:
var randomnumber=Math.floor(Math.random()*11)
Bill Gates is my home boy
Posts: 651
4740 credits Members referred : 0
« Reply #8 on: Jun 08, 2011, 08:02:27 pm »
Here's what I found: var randomnumber=Math.floor(Math.random()*11)
Affiliate Programs CPA Network Affiliate Network
OMG!I am geek
Posts: 56
372 credits Members referred : 0
« Reply #9 on: Aug 16, 2011, 01:27:47 pm »
I Have been using this code to generate a random number with js:
var max = 10 Math.floor(Math.random()+(max+1));
From what I understand that will generate a number from 0 to 10, but what if I want to generate a random number from 1 to 10? or from 5 to 10?
Sandwich Artist
Posts: 25
174 credits Members referred : 0
« Reply #10 on: Aug 17, 2011, 02:14:19 pm »
well idea.. it works good.. thanks..
Cyberpunk Wannabe
Posts: 44
300 credits Members referred : 0
« Reply #11 on: Aug 18, 2011, 11:39:37 am »
Generating a random number in JavaScript
A popular question on CodingForums.com is how to generate a random number in JavaScript. A random number is useful- if not required- in the creation of certain popular JS applications, such as a dice, random image script, or random link generator. In this JavaScript article, we'll learn how to output a random number that falls within the range 1 to x, where x is any integer >1.
The results may be unpredictable, but the technique to getting them certainly is not. To generate a random number in JavaScript, simply use the following code:
var randomnumber=Math.floor(Math.random()*11)
where 11 dictates that the random number will fall between 0-10. To increase the range to, say, 100, simply change 11 to 101 instead.
Cyberpunk Wannabe
Posts: 41
300 credits Members referred : 0
« Reply #12 on: Sep 24, 2011, 10:49:44 pm »
You would have to use a random function from javascript. ... What I want to do with this random number is generate it every time someone
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=7925