Raised This Month: $ Target: $400
 0% 

random(256) in one case


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-06-2015 , 22:11   Re: random(256) in one case
Reply With Quote #1

Basically, if you don't have a mathematical method (a forumula) for determining the what the R, G, and B values are for each case then it's not possible to not write them all out.

UNLESS, you are actually meaning that you want R to be random, G to be random, and B to be random (this will give you a random color every time). In this case, you can do this:

PHP Code:
rgbaura[0] = random(256);
rgbaura[1] = random(256);
rgbaura[2] = random(256); 
Also, you should never assign a whole array using an equal sign unless it is when you declare the variable (when you use "new"). In your case, you should assign each of the three values as shown above.
__________________

Last edited by fysiks; 12-06-2015 at 22:13.
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:49.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode