Let x, range, d be integers. We'd like to generate a number y, such that
1 <= y <= rangeabs(x-y) >= d
One idea I came up with is to generate some smaller range and then make some adjustments to handle the numbers which too close to x. But that's really tedious.
Is there any better way to do it?
Aucun commentaire:
Enregistrer un commentaire