I don't do shit for maths anymore, but there's no randomness in convention of elements(which I assume the rand(x,y) is). The order is always the same, the amount of elements always the same. Every class gets 4 elements, other than monks who get 5. Rotation is always Arcane, Cold, Fire, Holy...