F
FAQ server
-----------------------------------------------------------------------
FAQ Topic - How do I generate a random integer from 1 to
N?
-----------------------------------------------------------------------
function Random(x) { return Math.floor(x*Math.random()) }
gives a random integer in the range from 0 to x-1 inclusive; use
=AB Random(N)+1 =BB for 1 to N.
http://msdn.microsoft.com/library/d...html/a28c5c66-c42f-4082-9b71-9a5ee4652cd7.asp
http://docs.sun.com/source/816-6408-10/math.htm
How to Deal and Shuffle:
http://www.merlyn.demon.co.uk/js-randm.htm
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.
FAQ Topic - How do I generate a random integer from 1 to
N?
-----------------------------------------------------------------------
function Random(x) { return Math.floor(x*Math.random()) }
gives a random integer in the range from 0 to x-1 inclusive; use
=AB Random(N)+1 =BB for 1 to N.
http://msdn.microsoft.com/library/d...html/a28c5c66-c42f-4082-9b71-9a5ee4652cd7.asp
http://docs.sun.com/source/816-6408-10/math.htm
How to Deal and Shuffle:
http://www.merlyn.demon.co.uk/js-randm.htm
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javascript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.