
-----------------------------------
Wintermini
Sat Jan 09, 2010 3:36 pm

How do you randomize pictures?
-----------------------------------
Initially I wanted to randomize strings... but I don't think it's possible. This is actually for a multiple question, but I can do the button wait procedure or something so I'll let the user click on the answer.

-----------------------------------
TheGuardian001
Sat Jan 09, 2010 4:11 pm

Re: How do you randomize pictures?
-----------------------------------
You do randomized pictures the same way you do randomized strings.

first, store all the possibilities in an array:


var myPics : array 1 .. 10 of int

myPics(1) := Pic.FileNew("mypic.jpg")
...
myPics(10) := Pic.FileNew("myPic10.jpg")


Then generate a random number to decide what picture to display:


var tmp : int := Rand.Int(1,10)
Pic.Draw(myPics(tmp),x,y,picMode)


The same can be done with strings by changing the array into a string and replacing Pic.Draw with put.

-----------------------------------
Wintermini
Sat Jan 09, 2010 4:20 pm

RE:How do you randomize pictures?
-----------------------------------
OMG THANK YOU!!!

-----------------------------------
saranya
Thu Jan 14, 2010 9:20 pm

RE:How do you randomize pictures?
-----------------------------------
can u help me with making my pictures not repeat

-----------------------------------
Carey
Thu Jan 14, 2010 10:35 pm

RE:How do you randomize pictures?
-----------------------------------
You would have to store all previous numbers in an array, then when you pick a number, check the array to make sure it hasn't been picked before.  Alternatively, you could take your array of pictures and do a bunch of random swapping to mix the order up, then use a for loop to display them from 1 to 10

-----------------------------------
TheGuardian001
Thu Jan 14, 2010 10:38 pm

Re: RE:How do you randomize pictures?
-----------------------------------
can u help me with making my pictures not repeat

No, because I have no idea what you mean by that. Care to elaborate?
