What are the possible ways to generate a random time series?
3 views (last 30 days)
I require generating random times to test the computation. However, I got totally different results when I repeated my experiment for 1000 and, 10000 random time values. Here is the script that I used to generate random times.
NUMBER_RANDOM_TIMES = 10000;
SECONDS_PER_DAY = 24*60*60;
START_DATE = '2015-07-01';
END_DATE = '2021-12-31';
startDateNum = datenum(START_DATE,'yyyy-mm-dd');
endDateNum = datenum(END_DATE, 'yyyy-mm-dd');
dayRange = endDateNum - startDateNum;
secondsRange = SECONDS_PER_DAY*dayRange;
randomNumberOfSeconds = randi(secondsRange,NUMBER_RANDOM_TIMES,1);
randomDatenums = startDateNum + randomNumberOfSeconds/SECONDS_PER_DAY;
AA = datevec(randomDatenums);
I think maybe the random times generated by this method are biased. May someone share their thoughts and suggest other possible ways to generate random time's bounded between the start and end dates.