Random_numbers_in_Excel - If you want to “Flip a coin”...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Generatimg Random numbers in Excel High Low Decimal Random= 0 Integer Random= 0 Direction Left The general formula for a continuous random number over a specific range is: (RAND()*Range)+Lowest For example, let’s assume that you want to pick a random point along a road and the road is 300 m in length. In addition, you wanted to start at least one meter from the beginning of the road. The Range would be 300-1=299 and the lowest possible value would be 1. You would enter the following formula in Excel: =(Rand()*299)+1 (See the formula in D22) If you wanted to restrict your choice to an integer and not a decimal value, you would use the following formula: INT((RAND()*Range)+Lowest+0.5) (see the formula in D23) where Range is the difference between the highest possible value and the lowest possible value and where Lowest is the lowest possible value. Enter numbers in these two cells
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: If you want to “Flip a coin” in Excel, you can use the random formula combined with an “IF” function. In Excel, the IF function is: IF(statement evaluation, if true, if false). For example: IF(A3=1,”YES”,”NO”) would evaluate the contents of cell A3, If A3=1, then the cell containing the IF function would be equal to “YES”. For example, let’s say that we wanted to do a coin flip to determine if we should go left or right. To do a coin flip, we want a random number between .1 and 1. If the number is >0.5, we would go left; otherwise we would go right. You would enter in Excel: =IF(((RAND()*0.9)+0.1)>0.5,”Left”,”Right”) where: (RAND()*0.9)+0.1) will give a random number between 0.1 and 1.0 and the expression ((RAND()*0.9)+0.1)>0.5) will test to see if the random number is greater than 0.5 (See the formula in D24)...
View Full Document

This note was uploaded on 09/08/2010 for the course BIOL 160 at San Jose State.

Ask a homework question - tutors are online