Math.ceil(Math.random()*3

Math.ceil(Math.random()*3

Post by jeffpellet » Fri, 23 Dec 2005 00:39:23


Wondering what the next step to generate 1 or 2 or 3 or 4, or 1 or 2 or 3 or 4
or 5, etc in this sequence:

Math.floor(Math.random()*2+1) is an integer 1 or 2
Math.ceil(Math.random()*3) is an integer 1 or 2 or 3
 
 
 

Math.ceil(Math.random()*3

Post by David Stil » Fri, 23 Dec 2005 00:50:03

jeffpelletier,


Can you rephrase your question? It looks like you already have a
pattern that works. What are you missing?


David
stiller (at) quip (dot) net
"Luck is the residue of good design."

 
 
 

Math.ceil(Math.random()*3

Post by kgla » Fri, 23 Dec 2005 00:54:50

Math.ceil(Math.random()*MaxNum)
 
 
 

Math.ceil(Math.random()*3

Post by jeffpellet » Fri, 23 Dec 2005 01:00:01

Thanks!!