I voted for goodVibration's answer because it contains useful information about the addresses themselves.
You can't really do "random" at this time unless you use an Oracle to inject some randomness, otherwise, this is a deterministic system. Everyone can see the formula and the inputs so there is no doubt about the result.
You have to settle for unpredictable. Even that is tricky. Using "now" as a source of randomness is a step in the right direction, but there are issues:
- If two transactions are mined in the same block, they will have the same "now", ergo, the same address. That collision might not be what you want.
- A miner has latitude over the timeStamp, so if so motivated, they can play with the time until they generate a favourable "random" address.
You can "spice it up" a little:
address randomish = address(uint160(uint(keccak256(abi.encodePacked(nonce, blockhash(block.number))))));
nonce++;
The wrapping is merely doing explicit type conversions from a hash to an address. The nonce scrambles it up if two transactions go through in the same block. The block hash looks hard to guess because it's in the future. In practice, it is trivial to know. The method of attack would be another question. Suffice it say this is not a safe way to do it.
If there is any incentive to guess the "random" numbers (card game, lottery, etc.) then a popular pattern is commit and reveal. Commit and reveal is a two-step process. In step 1, players lock in their decisions. Then some further randomness is added. After the careful addition of an extra challenge (e.g. next block hash, that clearly cannot be known when the decisions were made), then generate the random(ish) number.
Hope it helps.