Posts: 576
Threads: 97
Joined: Aug 2007
Hey, i have the Uniform and str.Random files but i cannot use them for what im trying to do, i need to be able to enter a number and it generate a number from 1 to w/e number i typed in.
Is this possible? maybe someone can help me out.
Thanks. QM_Expert
Posts: 473
Threads: 33
Joined: Aug 2007
Here are a couple examples.
This generates 1 random number.
Macro ( Uniform_Example )
int random num
num=5;;edit your number here
random=Uniform(1 num)
out random
and
Macro ( Uniform_Example_Pi )
int repeats count num
num=5
repeats=Uniform(1 num)
out "Random repeats = %i" repeats
rep repeats+1
,out count
,count+1
This will generate numbers counting up to the random number.
ie: Random number chosen is 6; counts 0 1 2 3 4 5 6.
Taking on Quick Macros one day at a time
Posts: 576
Threads: 97
Joined: Aug 2007
thanks bro the first one did the job perfectly!
Posts: 67
Threads: 24
Joined: Feb 2009
How do I get it to count 65 numbers, all random 65 times, but not repeating itself, like not have the same number show up twice from 1 to 65
Function
Uniform_Example
rep 65
,int random num
,num=65;;edit your number here
,random=RandomInt(1 num)
,out random
Any help?
Posts: 58
Threads: 19
Joined: Mar 2005
Macro
ARRAY(int) a
a.create(65)
for _i 0 65
,a[_i] = _i + 1
int random
for _i 65 0 -1
,random = RandomInt(1 _i)
,out a[(random-1)]
,a.remove((random-1))