User Tag List

Results 1 to 5 of 5

Thread: Couples of random values in an Array

  1. #1
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Couples of random values in an Array

    Hi all!
    I have an 8x5 array. I want to initialize it with 20 couples of random values, ranging from 1 to 20. How do I do it?

    I've tried in different ways, but I always get weird results.
    Thank you in advanced for your help!

  2. #2
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,302
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    "20 couples of random values" makes no sense.

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I mean 20 couples of the same random value.

  4. #4
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,302
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    Oh, I see. There are lots of ways to do that, but here's one solution:
    (note: "ValueList" is a string; "PickedValue" is a value)

    + Start of frame
    -> Set ValueList to: "0102030405060708091011121314151617181920010203040 5060708091011121314151617181920"
    -> Start loop "Init", 40 times

    + On loop "Init"
    -> Set PickedValue to: "Random(Len(ValueList)/2)"
    -> Array: Write value "Val(Mid$(ValueList, PickedValue*2, 2))" to "LoopIndex("init") mod 8" , "LoopIndex("init")/8"
    -> Set ValueList to: "Left$(ValueList, (PickedValue*2))+Right$(ValueList, (Len(ValueList)-(PickedValue*2)-2))"

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Jul 2010
    Location
    Italy
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you!

Similar Threads

  1. Spreading values in a random order across an array
    By Ibis in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 6th September 2012, 04:34 AM
  2. Summing the values of an array
    By fawfulfan in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 18th July 2012, 07:14 PM
  3. Add values to Array without setting X and Y
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 12th March 2012, 11:58 PM
  4. Array vs. Counter vs. Object values
    By alxmrg in forum Hardware Accelerated Runtime
    Replies: 7
    Last Post: 19th May 2010, 10:12 PM
  5. Array of displayable strings/values?
    By Farflame in forum Multimedia Fusion 2 - Technical Support
    Replies: 20
    Last Post: 8th June 2009, 06:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •