You would first create a scene representing one planet. For simplicity, let's assume it consists of only one node: a Sprite with the texture of a circle (like this).
Then you would create another scene. I'll assume a Node2D here. It will represent your "universe". Now attach the following script to it:
# load your planet scene
var planet = preload("res://Planet.tscn")
# do this 20 times
for i in range(20):
# create a new instance of the planet scene
var new_planet = planet.instance()
# set its global_position to two random (float)
# values lying somewhere between 0 and 400
new_planet.global_position.x = rand_range(0, 400)
new_planet.global_position.y = rand_range(0, 400)
# add it as a child of this "universe"-node
Depending on where your planet-scene is located, how many planets you want to create and how big the considered area should be, you will have to adapt the code. In this form it's probably still not working precisely as you imagined it, but it should give you a rough idea on how to tackle a problem like this.