Is staking totally random or there is some sort of a reward position queue based on weight (coins in one input) ?
There is absolutely no queue.
If you want to know the technical details about how staking works...
A UTXO has some of its details taken from it and hashed using SHA256. SHA256 creates a 256 bit binary result that is completely random and
always different if one of the inputs that was hashed changes and
always the sameCDataStream ss(SER_GETHASH, 0);
ss << nStakeModifier << nTimeBlockFrom << nTxPrevOffset << nTxPrevTime << prevoutIndex << nTimeTx;
uint256 hashProofOfStake = Hash(ss.begin(), ss.end());
You successfully stake if the result of your hash produces a number that is less in value than the inverse of the difficulty target multiplied by the UTXO's coin weight.
bool validStake = hashProofOfStake < (bnCoinWeight * bnDifficulty);
So you can see here, that your hashProofOfStake is random. But whats not random is the coin weight and difficulty. The larger your coin weight is, the easier it is to create a random number that is less than the target.
For example, think of using a random number generator that generates a number between 1 and 100, what are the chances that you generate a number under 5? 5%. What if you increase the target to a number that is less than 10? Then it means you have a 10% chance. That is the exact same concept with staking and coin weight. The UTXO generates a random number with details that are verifiable by all peers and the weight gives you an easier target to meet.
The next thing to mention is that the variables from the UTXO that are being hashed will all remain the same except for one of them, the transaction time (nTimeTx) ie the current time right now. As I mentioned earlier if the inputs to the hashing algorithm are the same then the hash will not change. But since the time variable changes once every second that passes, you actually generate one attempt/hash per UTXO per second. This is the exact reason you want your wallet to remain up and staking as much as possible. If your wallet is down, it is missing attempts to stake.
Those are the very technical details and can be somewhat confusing, but that is how it works.