Thanks!Actually, I am not really know what is secnds(0.0) and SRand. The rest of them are pretty simple.I know that this is a random number generation.
Hi,
Oh, it was at leat 17 years ago I toucht that aqfull language!
Anyway, if I remeber it right, secnds(0.0) will return a value of seconds with 1 decimal accuracy, and Srand is a random generator.
So basicly, what you are doing is to create a good random number with the seed value based on the current time, so you will never have the same seed number for Pseudo Random Generator.
Hi,
Glad to be able to help. I am not so god with Mathlab, and I have no idea if there is a similar function in MatLab, that returns the current time in seconds, but do a quick search on gogle gave this:
In Matlab, use the clock function in order to read the current time.
In order to start the random generator with a “random” seed, use as follows in Matlab version 5 or more:
>>rand('state',sum(100*clock))
>>uniform_random_number = unidrnd(10) // or = random('Discrete Uniform',10)
This generate the discrete uniform random number {1,...,10}.
The first line is only necessary for matlab to generate different random sequence when the program is restarted.
Try to use "help" in matlab to find information.
>> help random
>> help rand
and et.