This transaction failed without reason, https://blockscout.com/etc/mainnet/tx/0x58c0a6880fcf5a04957384768865966a05869d864932ab88b7a5ae3491191db5/internal-transactions.
I don't think it ran out of gas, since the computation uses 70% of the GAS provided. And worked the next time I tried, no parameters changed except different blockhash in random number generator. I see nothing wrong with the code. And I re-ran the function in Remix a dozen times, it works.
The only reason I could see, is if the state "lagged", that the state transition that happened 4 blocks earlier (that was necessary to pass a check in the function) somehow was not accounted for in the transaction. But if the miner "artificially" failed it because they didn't keep track of the state, this must mean that the majority of miners agreed with that, or the block would have been rejected. That should not happen unless the majority of miners are corrupt.
So I don't know why it failed. Anyone have any insight to why it failed? This might not be the place to ask for transaction debugging, but it was recommended to do so here: Debugging a failed transaction.