how to select random variable?
how to select random variable?
Like: new variable1; new variable2; new variable3; I should pick one of these up to my dating! Like: random_function(variable1,variable2,variable3 ), and return variable on random! Example return: variable3 Thanx, sorry my english xD |
Re: how to select random variable?
random_function(variable1, variable2, variable3) {
switch (random_num(0,2)) { case 0: return variable1 case 1: return variable2 case 2: return variable3 } } or just have those variables as an array new variable[3] variable[random_num(0,2)] //random value from array |
Re: how to select random variable?
Lol, thanx
|
Re: how to select random variable?
Can you use like enum?
for example: PHP Code:
PHP Code:
|
Re: how to select random variable?
It would be better to use an array, because it is shorter code and easier to extend.
Code:
Code:
|
Re: how to select random variable?
Quote:
|
Re: how to select random variable?
Quote:
|
Re: how to select random variable?
No it won't unless the values are constants.
|
| All times are GMT -4. The time now is 05:48. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.