Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Rand.Int (colours)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
gohan




PostPosted: Tue Jun 07, 2005 9:13 am   Post subject: Rand.Int (colours)

Ok, here I go...I would like to know if you can have certain colours as your Rand.Int...for example..I would like only the colours that I want to appear up...wow this is hard to explain..umm...lets say i only want 50 specific colours..(blue,red,green,purple,orange,brightblue,brightred,etc..), but I want them to appear in random order..can i specifically into the variable somehow...

here is what i have for all colours,but all i want is 50 of the 255 colours..not all of them in Rand.Int..plzz help!!
code:
var clr : int
clr := Rand.Int (1, maxcolour)


Plzz type back if you want me to explain more...
Sponsor
Sponsor
Sponsor
sponsor
c0bra54




PostPosted: Tue Jun 07, 2005 9:51 am   Post subject: (No subject)

only thing i can suggest is haveing an array of 1..5 int and having the numbers you want in a text file

then open the text file, and using a forloop to load colours, load them nermericly into you array,

next use randint to get a number between 1 and 50, and have that number be the corresponding array space...
[Gandalf]




PostPosted: Tue Jun 07, 2005 3:42 pm   Post subject: (No subject)

Just make an array with all the colours you want in it (16,163,200,etc) and then call a random number from those using
Turing:
colour(colourarray(Rand.Int(1,numberofcoloursinarray)))

No need to make this harder than it really is, which is quite easy.
c0bra54




PostPosted: Tue Jun 07, 2005 8:30 pm   Post subject: (No subject)

wow and i thought my way was good.. :p
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: