Spawning entites across a map randomly.

I need a code that will spawn a given entity at a random point on the map. to give and example of exactly what i am looking for, a remake of the old winter survival spawn code. Where it picks a random point on the map and spawns so far below the top of the map. it is very VERY vital to my gamemode and i will be very happy if i can finally get this script so that i may continue with my progress. Thank you in advance.