View Single Post
  #2  
Old 12-16-2014, 04:34 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
random(a, b) returns a random number in the range [a, b).

So what you probably want to do is take the number you got in your second example and use it as the index of your array.

PHP Code:
function onCreated(){ 
  
temp.images = { "test1""test2" }; 
  
temp.random temp.images[int(random(0temp.images.size()))];
  echo(
temp.random);

__________________
Reply With Quote