10-18-2015 04:38 PM - edited 10-18-2015 04:41 PM
Thanks, it's because in a data step, the first seed encountered will determine the whole stream, right?
Another question, then can I write
without assigning a seed for the second variable since whatever seed set to b would prove to be useless?
10-22-2015 10:47 AM
In your example, it doesn't matter what seed value you use for b. You will always get
A random number seed initializes a sequence of pseudorandom values. For the RANUNI function (and other RAN* functions), the first time you use a seed determines the sequence for the rest of the data step.
Here are two related articles:
My mental model for a stream is this: I have a spiral notebook with thousands of sheets of papers. On each page, I write down a sequence of random numbers. The first sheet can have the same numbers as another sheet, but they are in different orders.
The "seed" corresponds to a page. When you want a sequence of random numbers, you tell me what page you want. I then read off the numbers on that page one at a time. If you want a different sequence, you need to ask for a different page.