I'm generating a pseudorandom number using Solidity. I understand the deterministic nature of the blockchain and the necessity of using an oracle for a seed. That said, I'm selling randomized items that are generated dynamically, which I'm using the following line to generate:
uint random = uint(keccak256(abi.encodePacked(msg.sender, block.number, newItemId)));
In this randomized number, I've used as seed the caller address, block number, and new Item id, which increases at every buy() function call. When looking at it, it seems fine, as the attacker could manipulate the sender address and guess the block number with a few tries, but getting a predictable newItemId would be difficult because they won't know if someone else is buying at the same time, taking precedence in the block processing order and getting another ID.
A miner could try to mine valid blocks and throw them out until they get one with the prize they want, but the max prize on this would be worth about 300 dollars, which makes it not worth the effort.
Does this work or am I missing something? Is it possible to exploit this in a way I am not aware of?