Game Maker Games, Articles, Tutorials & More

Game Maker Network


Howdy, Guest! Please sign in or register an account.

Print

string_scramble

By Daniel · December 27, 2008

Scrambles the characters in a string

// string_scramble(str)
// Scrambles the characters in str

var in, out, pos;

in = argument0;
out = '';

while (string_length(in) > 0) {
  pos = floor(random(string_length(in))) + 1;
  out += string_char_at(in, pos);
  in = string_delete(in, pos, 1);
}

return out;

Categories: String handling

Comments

There are no comments to display.

Post a Comment

You must be signed in to post comments.

Advertisement