It works but a better way that also makes cheating (by both sides) much harder is this:
1. Server chooses a random entropy and keeps it private.
2. Server releases the hash of that entropy (so that server can not change the seed later, also SHA256 is used because in step 5 we use SHA512)
SHA256: cf4ff8d8e6915d752aff0878ccd3a53bda3456d75e636ba9fe95572ac2ea1913
3. One or more future block heights is chosen and announced as the additional entropy to be used.
4. The list of participants is locked with each one having an index (from 0 to max count -1)
5. The algorithm to derive the result is publishes (the steps here).
[Now that everything is locked and can not change, we wait for the blocks to be mined]
6. Compute HMACSHA512 using the 3 block hashes (concatenated) and the actual seed from step 1 as the key to derive a 512-bit entropy.
HMACSHA512(block876582 | block876583 | block876584, key=ServerSeed) = 38f6ce46c9fbfeff669c7656883f2eb7a23a3b96d8a6d5ae278ba1939d4abf9722c12bdda04c72cd8c0633c7da89636d4171d9b670a60c7ca6bf7a6dac4bea09
7. Server publishes the entropy/seed from step 1 for everyone to verify
ServerSeed = 02236c4098bbddbc84aca10a3aac3f514a38a549632a159298e0944e8373cd58
8. Select bits from step 6 to get your integers. Something like this:
int max = 20
winner #1 = 0x38 % max = 16
winner #2 = 0xf6 % max = 6
winner #3 = 0xce % max = 6 reject as duplicate
winner #3 = 0x46 % max = 10
Step 6 and 8 can be changed to use a different KDF that derives keys and converts them to integers in a loop, but the basic idea of it is what I described here.