Reply To: Randomly Shuffle Positions of Elements

PennController for IBEX Forums FAQ / Tips Randomly Shuffle Positions of Elements Reply To: Randomly Shuffle Positions of Elements

#9619
Jeremy
Keymaster

Hi Yev,

Use the Selector element’s shuffle command, as illustrated above and in the tutorial:

newSelector("images")
,
defaultImage.size(100,100).selector("images")
,
newCanvas("3x3", 300, 300)
  .add(  0,  0,newImage("one.png"))
  .add(100,  0,newImage("two.png"))
  .add(200,  0,newImage("three.png"))
  .add(  0,100,newImage("four.png"))
  .add(100,100,newImage("five.png"))
  .add(200,100,newImage("six.png"))
  .add(  0,200,newImage("seven.png"))
  .add(100,200,newImage("eight.png"))
  .add(200,200,newImage("nine.png"))
  .print()
,
getSelector("images").shuffle().disable()

Jeremy