Creation of PoS raffle
The raffle happens every once in a chosen period of time if at least one transactions is pending in the pool. If there are no transactions in the pool, the current iteration is skipped, and the block is not formed. Only nodes that were registered before the raffle starts can take part in it. After this, the list of participants is generated by adding all existing nodes to a new list in amounts that depend on the weight coefficients of the node. Weight coefficients can be the number of coins, time of coins holding etc.
After the list is formed, it is sorted in ascending order. A winner is chosen randomly from the sorted list. The seed of the random number generated is the height of the current block and some other constant parameters.