Another Random Generation Problem

Hello.

I have yet another problem connected to my random generator. Well, technically two generators. You see, my generation scripts work like this:
First one creates random star constellation in which every star takes you to a “system level” after clicking it.

Second one creates random star system via this code (LiczbaPlanet means number of planets):

using UnityEngine;
using System.Collections;

public class Generatorv2 : MonoBehaviour {
     
    public Transform Sun;
    public GameObject prefab; 
	
    private float currDist = 20f;
    private float minDist = 40f; // Minimum distance from the previous planet
    private float maxDist = 50f;
	
	private float RandomFloat;
     
    private float LiczbaPlanet;
     
    void Start() {
		
		
		LiczbaPlanet = Random.Range(1,9);
		PlacePlanets();
    }
     
    void PlacePlanets() {
     
    for (float i = 0f; i < LiczbaPlanet; i++) {
    
    currDist = currDist + Random.Range(minDist, maxDist);
    Vector3 v3 = Vector3.right * currDist;
    v3 = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up) * v3;
    v3 += Sun.position;
     
    Instantiate(prefab,new Vector3(v3.x, 0, v3.z), Quaternion.Euler(0,0,0));
    }
    }

	void Update(){
		
	
		
		
	}		

}

Here’s an example of randlomly generated system:

Now to the problem/question:

Is there any way in which i could have particular stars (in the star contellation) assigned to one randomly generated star system, so it would work like this:

I click a star and the code generates a random star system, and when i close it and click again on the same star i would have same star system.

I appreciate any kind of help/answar.

-Xentarok

P.S. - My english isn’t very good, so forgive me my mistakes.

P.S.2 - If you have any questions about my question or you want more specific information, ask for it in the comment section.

The typical way to solve this problem is to use a random seed. For a given seed, random number generators will generate the same sequence of numbers. So to regenerate your planets, you reset the seed before you call the regenerate code. For each sun in your constellation, you assign or generate an integer. For example, you could multiply the x,y and z components of the position together and convert it to an integer. Or do x * 100 + y + 10 + z. You then set this integer to the seed before you generate the planets.

Note that .NET also has a random class. The .NET class allows you to create multiple class instances. I’m not sure where you are going with this project, but the .NET class is an option you might want to be aware of.