The following line returns a pair of coordinates
coordinates = random.random()*640.0, random.random()*480.0
How to get a particular pair of coordinates for example (100.0, 100.0) with probability 0.03. Coordinates are generated in a loop, a number of loops is different every run, but the maximum of loops is 1000.
I'm not sure what it is. Google says it's weighted random. But all examples contain the list of probabilities, I have only one particular value with a given probability.
EDIT: Sorry guys, it's uniform sampling and it's floats.
I would solve the problem in two steps:
Step 1) Make (100,100) come up 3% of the time - Roll a random value from 0 to 1. If the value is less than 0.03 then return (100, 100), otherwise continue to Step 2.
Step 2) Handle the other 97% case. Return a random coordinate between whatever values you want the way you're already doing it. It's not really clear what you want to happen here - Based on your example, I'm guessing you want to pick a uniformly distributed value between (0,0) and (640,480).
There's an extremely small chance that you'll get (100, 100) in step 2. If it's super important that the probability of getting (100, 100) is exactly 3% and not slightly more than 3%, then check for (100,100) in step 2 and re-roll if you get it by chance. It's so incredibly unlikely if you're generating float coordinates that you can just omit this check.
If your coordinates are integers only, then accidentally getting (100, 100) is still pretty unlikely, but it could still happen. See pjs's answer