Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Random Function
#1
I want to create a random statement that will create one string by picking a random element from array1 followed by a random element from array2. Can you help me?

array1 = ["AL", "AK", "AZ", "AR", "CA" ......] (51 elements total)
array2 = ["S" "M" "T" "W" "F"] (5 elements total)
#2
you may have a function called "uniform" in your version of QM (if not search the forum for it); it will give you a random number from limits you set and you can use it to get the value from the first and another one for the second array.

sorry cant code if for you; im really weak at arrays.
Ken
#3
Code:
Copy      Help
ARRAY(str) a1 a2
a1="AL[]AK[]AZ[]AR[]CA"
a2="S[]M[]T[]W[]F"
str s.from(a1[Uniform(0 a1.ubound)] a2[Uniform(0 a2.ubound)])
out s
#4
It says Uniform is unknown identifier.
#5
Create new function (not macro), name it Uniform (must match case), paste code from

http://www.quickmacros.com/forum/showthread.php?tid=77
#6
Works thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)