The Daily Click ::. Forums ::. Klik Coding Help ::. another random number problem
 

Post Reply  Post Oekaki 
 

Posted By Message

Filip Miljkovic



Registered
  24/04/2013 17:20:40
Points
  3
24th April, 2013 at 24/04/2013 17:45:17 -

Greetings!

Can anyone explain to me how does the random() function work if I need to pick a number out of tho ranges different in size?

For example, I need one of these numbers : 1 5 6 7 8 or 1 2 6 7 8

 
n/a

Filip Miljkovic



Registered
  24/04/2013 17:20:40
Points
  3
24th April, 2013 at 24/04/2013 17:45:59 -

*two ranges

 
n/a

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
24th April, 2013 at 24/04/2013 18:22:18 -

Try this. You'll need to use two Alterable Variables for an Active Object.



IF Start of Frame
THEN Set Alterable A of Active Object to Random(10)

IF Alterable Value A of Active Object = 0
THEN Set Alterable Value B to 1

IF Alterable Value A of Active Object = 1
THEN Set Alterable Value B to 5

IF Alterable Value A of Active Object = 2
THEN Set Alterable Value B to 6

Etc...


I think you catch my drift. Simply select the number based on a different, randomly-selected Alterable Value of a traditional range.

 
n/a

Filip Miljkovic



Registered
  24/04/2013 17:20:40
Points
  3
24th April, 2013 at 24/04/2013 18:45:58 -

That is a very good idea! Thank you very much!!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click