randumb!

Hey,
I know the random thing has been discussed to death but anyone got any new clever ideas?
I need to assign 4 attributes each with a unique integer 1,2, 3 or 4 in a random order with no repeats.
I know about seeding the random function to make it more random but is there a simple way to populate the attributes.
As it stands I'm thinking I have to do this :
game.att1 = random
game.att2 = random
check att2 does not equal game.att1
if it does try again
game.att3 = random
check att3 does not equal game.att1 or game.att2 etc....
I know the random thing has been discussed to death but anyone got any new clever ideas?
I need to assign 4 attributes each with a unique integer 1,2, 3 or 4 in a random order with no repeats.
I know about seeding the random function to make it more random but is there a simple way to populate the attributes.
As it stands I'm thinking I have to do this :
game.att1 = random
game.att2 = random
check att2 does not equal game.att1
if it does try again
game.att3 = random
check att3 does not equal game.att1 or game.att2 etc....
Comments
I'm running a random on att1, att2 and att3 on a timer every 0 seconds loop until the player hits play (tsb's suggestion in an old post)
then when they hit play I have 1.5 seconds to deal with any repeats so every 0.1 seconds it checks
if att1 = att2 if they do att2=new random
otherwise check if att3 = att1 or att3 = att2 if they do att3= new random
that shouldn't be too taxing to work everytime within 15 passes of the loop (i hope and will keep testing)
the final att4 is simply 10 minus the sum of the other 3.
I'm running with this but if anyone can help improve please post it up
Cheers