Random Number Generator

 

Setup|Glossary Variables provides commands to generate random numbers for all or a select group of respondents in your data file.

You can define a variable in the glossary for storing the random number generated for each respondent or you can use the internal variable _RANDOM in WinCross logic.

 

For example, the following commands:

 

DECLARE MY_NUMBER:4

_RANDOM_SEED 1

_RANDOM_HIGH 9999

_RANDOM_LOW 1

ASSIGN MY_NUMBER = _RANDOM

 

will generate a random number from 1 to 9999 and assign the random number into the new variable MY_NUMBER.

 

If you use the Save Data As option of Setup|Glossary Variables, the MY_NUMBER variable will be added to your data file and will contain a random number between 1 and 999 for each respondent. If you use the Save Data As option more than once, the RANDOM_SEED 1 command assures that the same random number is generated for each respondent.

Related topics:

Glossary Variables