RPC with Random Numbers!

Here is my code
using UnityEngine;
using System.Collections;

public class StarCreate : Photon.MonoBehaviour {
	public GameObject prefab;
	public int StarCount;

	// Use this for initialization

	void Start () {
		GetComponent<PhotonView> ().RPC (
			"UniCreate",
			PhotonTargets.All);


	}
	[RPC]
	void UniCreate (){
		StarCount = Random.Range (100, 200);
		int i = 0;
		while (i < StarCount) {
			Instantiate(prefab, new Vector3 (Random.Range (-10000,100000), Random.Range (-10000,100000),Random.Range (-100000,100000)), Quaternion.identity);
			i++;
		}
	}

so I was wondering how you sync Random Numbers over the network though rpc! The problem is that every client gets the prefab instantiated in a different place! I want the Prefab to be instantiated in a random area but the same for every client though! That’s all thanks for the help (BTW I did search the web for solutions to this but could not find any similar to my problem, so I I’m not that lazy XD).

Roll the dice in Start, before you make the RPC, and send the Vector3 result. In other words, one person is responsible for the randomness. Everyone else just gets an RPC “make a new thing at this position.”

You would add an argument to the method that you pass a value to

 public class StarCreate : Photon.MonoBehaviour {
     public GameObject prefab;
     public int StarCount;
 
     // Use this for initialization
 
     void Start () {

         //I create a random Number
            float rnd = Random.Range(0.0f, 100.0f);

         //Rpc has thee parts to the method (name of RPC, Targets, Arguments[])
         GetComponent<PhotonView> ().RPC (
             "UniCreate",
             PhotonTargets.All,
             rnd); //now the rnd value is sent to the rpc
 
 
     }
     [RPC]
     //Here I make an argument called rnd of type float
     void UniCreate (float rnd){

           //rnd will now be the same for all clients
      
         StarCount = Random.Range (100, 200);
         int i = 0;
         while (i < StarCount) {
             Instantiate(prefab, new Vector3 (Random.Range (-10000,100000), Random.Range (-10000,100000),Random.Range (-100000,100000)), Quaternion.identity);
             i++;
         }
     }