Computer Science Canada

Rand.Int (colours)

Author:  gohan [ 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...

Author:  c0bra54 [ Tue Jun 07, 2005 9:51 am ]
Post 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...

Author:  [Gandalf] [ Tue Jun 07, 2005 3:42 pm ]
Post 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.

Author:  c0bra54 [ Tue Jun 07, 2005 8:30 pm ]
Post subject: 

wow and i thought my way was good.. :p


: