#Java 10, 250 242242 222 bytes
-20 bytes thanks to @nwellnhof.
import java.util.*; // Required import for HashSet and Arrays n->{ // Method with int parameter and Set return-type for(;;){ // Loop indefinitely int i=n+1, // Set `i` to `n+1` r[]=new int[i],int[i]; // Create an array of size `n+1` d[]=newvar int[n];S=new HashSet(); // Create another array ofResult-set, sizestarting `n`empty for(r[n<2? // If `n` is 1: 0 // Set the first item in the first array to: : // Else: 1] // Set the second item in the first array to: =n*n; // `n` squared i-->2;) // Loop `i` in the range [`n`, 2]: r[i]= // Set the `i`'th value in the first array to: (int)(Math.random()*n*n); // A random value in the range [0, `n` squared) var S=new HashSet(); // Result-set, starting empty for(Arrays.sort(r), // Sort the first array i=n;i-->0;) // Loop `i` in the range (`n`, 0]: S.add( // Add to the Set, d[i]= // and set the `i`'th value in the second array to: r[i+1]-r[i]); // The `i+1`'th and `i`'th difference of the first array if(!S.contains(0) // If the Set does not contain a 0 &S.size()==n) // and its size is equal to `n`: return S;}} // Return this Set as the result // (Implicit else: continue the infinite loop)