[help] random
#1

Hi, I want to make a random car color with all the 127 colors.
Have I to do new rc[]={0,1,3,...,and so on,...,127,126};, or is it possible to write it like rc[]={from 0 to 126};?
Reply
#2

can't you use random function? random(127) which would return a value from 0 to 126 you can use to set color as? ;]
Reply
#3

Код:
SetVehicleColor(vehicleid, random(126), random(126));
?
Reply
#4

that, won't select ALL random colors, there are 126 colors and 127 is 0, so if a random starts from 0 it hsould be 127 of size which would not make the car go black as this can't return 127. btw there are nice colors at 400+ 432 I think is verry dark green, looking sexy ;]
Reply
#5

Thank you.
Quote:

can't you use random function?

Sorry, but I'm a beginner.
Reply
#6

And what to do if I need numbers between e.g. 100 and 200?
Reply
#7

umm new rand = 100+random(101);
this would go for numbers 100 - 200. figuring how it works? ;]
Reply
#8

I use this system, It's easier to remember
random(max-min+1)+min;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)