# ItsMods

Full Version: Give Diffrent Random Numbers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,
i have a function which will give 8 Variables with a random amount.

But, how can i code, that every Variable has a diffrent amount? So if var1 and var5 is same it should make as long random amounts for var5 till its not the same like var1?
Code:
C++ Code
`for(i = 1; i <= 8; i++) { level.WepPartSpawning[i] = randomInt(level.WepPartSpawnNumber)+1; }`

Here ive tried to solve it, but doesnt work :/
C++ Code
`for(i = 1; i <= 8; i++) { level.WepPartSpawning[i] = randomInt(level.WepPartSpawnNumber)+1; for(r = 1; r <= 8; r++) { if(isDefined(level.WepPartSpawning[r]) && level.WepPartSpawning[i] == level.WepPartSpawning[r] && i != r) level.WepPartSpawning[i] = randomInt(level.WepPartSpawnNumber)+1; continue; } }`

Help pls how much is level.weaponpartspawn blabla?
The first index in an array is 0, so adjust your 'for' loops accordingly. Try it, if it doesn't work, do a desk check.
Code:
```while( var1 == var5 )     var5 = randomInt( 3240204240 );```
(08-23-2011, 13:13)iAegle Wrote: [ -> ]
Code:
```while( var1 == var5 )     var5 = randomInt( 3240204240 );```

For example i want to create 8 random numbers. but in the end nooneshould be the same. so

Code:
`while(var1 == var5)`

wouldnt work