![]() |
Random number draw
PHP Code:
|
PHP Code:
|
Quote:
PHP Code:
I'm not too familiar with random integer scripts but of what I know that's not right because the only number between 1 and 3 is 2. I need it to only pick from 1 or 3. |
Quote:
random(1,3) gives you a random number between 1 and 3 (though never the high number, in this case 3.) So for example, random(1,3) might give you 2.5, or 1.72, etc. int() then rounds the number down to the nearest integer. (so 2.5 becomes 2, 1.99 becomes 1.) So PHP Code:
|
Quote:
PHP Code:
|
Quote:
|
heres my input :P
PHP Code:
|
Those are some of the most weirdly complicated ways of doing this I've seen.
PHP Code:
|
PHP Code:
Edit: For more information on the ternary operator. http://en.wikipedia.org/wiki/Ternary_operator |
Quote:
|
Quote:
|
@scriptless,
Its all about readability and efficiency. |
Quote:
|
Quote:
I figured it out! And sorry, I'm really trying to learn. |
Quote:
|
Quote:
@Crow, Yes consistency is also key. |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
It would most likely confuse any new person who has yet to begin a class tho is what I was meaning. Someone that knows nothing yet would be more likely to read cbk's. Quote:
|
You all are making it so complex, but with GS2, you can tackle this problem simply.
PHP Code:
|
Quote:
|
Quote:
Quote:
|
Quote:
|
Quote:
It's always worked for me, my apologies. |
| All times are GMT +2. The time now is 03:47 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.