50 likes | 223 Views
Random Number Generation. Dates Setting up Random Dates is a simple process using the Date function. = Randbetween ( StartDate,EndDate ) Dates in a Range of Years
E N D
Random Number Generation • Dates • Setting up Random Dates is a simple process using the Date function. =Randbetween(StartDate,EndDate) Dates in a Range of Years =Randbetween(Date(2000,1,1),Date(2011,12,31)) Will give a list of Random dates between 1 Jan 2000 and 31 Dec 2011 Dates in a Month =Date(2010, 6, Randbetween(1,30)) Will give a list of Random dates between 1 June 2010 and 30 June 2010 Prepared by Sam Mosallaeipour
Random Integers Return Integers between Start and Finish • =Randbetween(Start, Finish) • =Randbetween(50, 100) • Will return an Integer between 50 and 100 • Random Numbers =Rand() Will return a random number between 0 and 1 If you want to generate a uniform distribution you should use “=RAND ()*(b-a) +a” which produce a set of numbers between a And B with a uniform distribution. =Round(Rand()*100, 2) Will Return Numbers between 0 and 100 with 2 Decimal places Prepared by Sam Mosallaeipour
Random Numbers Based on a Distribution =Norminv(Rand(), Mean, SD) Will return a random number between 0 and 1 based on a distribution of Average = Mean and Standard Deviation = SD =Norminv(Rand(), 50, 17) Will return a random number between 0 and 100 based on a distribution of Average = 50 and Standard Deviation = 17, • Random Numbers Fitting a Trend If your distribution has to match a trend add a Random component to the Trends equation eg; Y=mX+c = rand() * X + rand()*5 = rand() * A2 + rand()*5 Prepared by Sam Mosallaeipour
Combination Text and Numbers The above techniques can be combined to make lists of Alpha Numeric Data Say your business has a fleet of vehicles (TR=Truck, VN=Van, CAR=Car) =Choose(Randbetween(1,3),”TR”,”VN”,”CAR”) & Text(Randbetween(1,15),”0#”) Will randomly choose 1 of “TR”,”VN”,”CAR” and add a random number between 1 and 15 to it format with a leading 0, eg: TR05 Prepared by Sam Mosallaeipour