User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Way of doing random numbers that does not repeat?

  1. #1
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question Way of doing random numbers that does not repeat?

    Do anyone know of a good way to do like 10 random numbers and make sure they are all different?

  2. #2
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)Fusion 2.5+ DLC (Steam)

    Join Date
    Apr 2012
    Posts
    377
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could save each random number and if the random number generated is similar to any of the previous ones, generate a new one?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module

    Join Date
    Mar 2010
    Location
    Lier, Norway
    Posts
    276
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

  4. #4
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aasland View Post
    Hm I dont really understand what is happening in your example :/ Could you explain?

  5. #5
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    I am still struggling with this. If anyone could help I would be really happy!

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by krolik View Post
    Use an array. Get a some random value save it to current cell and compare with all others. If current value is equal to value from rest of cells just try again.
    Ah thanks. I made an example, maybe other finds this useful. I have one question though, it seems I need to use an dimension of 6 in the array if I want to create 5 random numbers. Why do I need to use dimension 6 and not 5?
    Attached files Attached files

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    I have one question though, it seems I need to use an dimension of 6 in the array if I want to create 5 random numbers. Why do I need to use dimension 6 and not 5?
    That's because you add to the x-index before writing to it.

    I've attached an updated example including another solution to the problem. I also wrapped your method into a fastloop so that the numbers are generated instantly.
    Attached files Attached files

  8. #8
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,237
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Popcorn View Post
    That's because you add to the x-index before writing to it.

    I've attached an updated example including another solution to the problem. I also wrapped your method into a fastloop so that the numbers are generated instantly.
    Thanks By the way Popcorn, I am playing a game right now called Insanely Twisted Shadow Planet and in credits there is a thanks to a "Popcorn". Is that you? :P

  9. #9
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Popcorn's Avatar
    Join Date
    Jun 2006
    Location
    Norway, Bergen
    Posts
    2,366
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    No idea, but probably not since I haven't heard about that game before

  10. #10
    Clicker Fusion 2.5
    Del_Duio's Avatar
    Join Date
    Sep 2008
    Location
    Cygnus X-I
    Posts
    944
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ^^ Could be the actual popcorn food. Like say the programmer ate a **** ton of popcorn all night while making his game. ^^

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Random Numbers and expiring the result numbers.
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th April 2013, 04:11 PM
  2. Random Number Range + Not allowed to repeat
    By Renatos in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 4th August 2012, 06:39 AM
  3. Random numbers help
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 5th January 2010, 12:41 PM
  4. Random Numbers Greater then Random Numbers...
    By Hordolur in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 15th April 2009, 06:24 AM
  5. random numbers
    By delusan in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 24th March 2007, 05:09 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
  •