Hi, I have a lengthy simulation program composed of many m-files (in total about 1000 lines). It uses several different random number generators (rand, randn, poissrnd, gamrnd, etc) and use these very numerous times. I set a random seed using rng at the very beginning of the main program that calls other m-files. I just noticed that outcomes from the program were not repeatable even though I use the same seed. I examined the code carefully and pinpointed that the matlab function randg is causing this problem. I placed rand(1) just before and after randg and sometimes (not always) rand(1) placed after randg gives a different number. Strangly, the different numbers are not any number; it is from a small set of numbers. Although I ran my code many times to check this issue, so far I have seen only 3-4 different numbers generated from the rand(1) placed after randg. Has anyone encountered this type of problems with randg before? What would be the reason for this? Would it be possible there may be some numerical errors in randg function? Is there anyway this problem can be resolved? Thank you.