In Qgis 2.18, you can use the processing algorithm Random points in layer bounds
Run it on your building layer, it will create random points everywhere in the extent of your layer.
Then use select by location, to select the points that intersects/ are wihtin a building an delete them.
The result is a point layer with only point that don't overlaped a building
I just realize that this answer use the same approach as @Albert one...
To get a regular number of point (e.g. 5000 points), you could use the method described by @Albert in his comment:
I suggest you to create enough points to have an excess once you have erased the points in your buildings. Then, to randomly keep exactly 5000, create a new field in the field calculator with this expression: rand( 0,10000000) This will create a random number from 0 to 10M that you can use to order the points and keep, say, the first 5k.