* Use RV.UNIFORM function to generate integers in the range 1-7.
* From the FM: "The uniform distribution takes values in the range a<x<b".
* Let a=1 and b=8, and then use TRUNC.
new file.
dataset close all.
input program.
loop #i = 1 to 250.
- compute X = trunc(rv.uniform(1,8)).
- end case.
end loop.
end file.
end input program.
frequencies X.
<quote author="Clive">
Hi,
I want to generate a set of 250 numbers drawn from the set of integers
[1,2,3,4,5,6,7}. I wonder if there is a simple way to do this in syntax, as
I haven't been able yet to do this with the various RAND. functions, other
than generating real numbers and re-computing them with other functions.
Thanks in advance for help,
Clive
=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD