Powered by Invision Power Board

 
    Reply to this topicStart new topicStart Poll

> Randomising the order of an array (Solved), Game Maker
India
Char
Posted: Dec 20 2008, 10:39 AM
Quote Post


fad was bad
[M][*][*]

Group Icon
Group: Admins
Posts: 2123
Member No.: 2856
Joined: 25-October 06

Status: (0d) [--]


Say I had an array consisting of {"a","b","c","d","e","f"}
How would I make it so that all the values in the array were moved around, so that it was something like {"b","f","d","a","c","e"}?

Game Maker btw.

This post has been edited by Char on Dec 22 2008, 12:26 PM


--------------------
aa this broke


Make your own | If a level is breaking the rules, note the ID and PM me.
Reference (thanks Frogjester!)
PMEmail PosterUsers WebsiteAOLYahooMSN
Top
Austria
Guinea
Posted: Dec 20 2008, 11:04 AM
Quote Post


6
[A][*][*][*][*]
[*][*][*][*][*]
[*]

Group Icon
Group: Admins
Posts: 8600
Member No.: 893
Joined: 15-March 05

Status: (0d) [--]


QUOTE (Char @ Dec 20 2008, 04:39 PM)
Say I had an array consisting of {"a","b","c","d","e","f"}
How would I make it so that all the values in the array were moved around, so that it was something like {"b","f","d","a","c","e"}?

Game Maker btw.

Usually I use list-constructions to do this in GM.
ds_list_shuffle() then does the trick.
I'm not sure if there's an option like this for arrays.
PMEmail PosterAOLMSN
Top
India
Char
Posted: Dec 20 2008, 11:05 AM
Quote Post


fad was bad
[M][*][*]

Group Icon
Group: Admins
Posts: 2123
Member No.: 2856
Joined: 25-October 06

Status: (0d) [--]


Ah, thanks.
(Not too hard to switch over to a list, it's just one array.)

Wait actually,
there's no ds_list_shuffle() function..
Whaaat.

Blah I'll just use ds lists and while loops
:V

This post has been edited by Char on Dec 20 2008, 11:40 AM


--------------------
aa this broke


Make your own | If a level is breaking the rules, note the ID and PM me.
Reference (thanks Frogjester!)
PMEmail PosterUsers WebsiteAOLYahooMSN
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

  Topic Options Topic Options Reply to this topicStart new topicStart Poll

 




[ Script Execution time: 0.0403 ]   [ 14 queries used ]   [ GZIP Enabled ]   [ Server Load: 0.35 ]