Two different random numbers

Hello every one

I want to have 2 different random numbers in other word I was wrote this code for my game that makes different places and never shouldn’t chosen prefab be same as chosen position.
I don’t how to do it?

I think one of them could be random and other one be serial and then that one random shouldn’t be repeated and also the chosen prefab shouldn’t be same with chosen position.

function Replace (){
	var PrefabsList : List.<GameObject> = new List.<GameObject>(prefabs);
	var PositionsList : List.<Vector3> = new List.<Vector3>(positions);
	while(PrefabsList.Count > 0){
		var ChosenPosition : int = Random.Range(0 , PositionsList.Count);
		var ChosenPrefab : int = Random.Range(0 , PrefabsList.Count);
			PrefabsList[ChosenPrefab].transform.position = PositionsList[ChosenPosition];
	GameObject.Instantiate( chief_Prefab , twelve_InGame.transform.position , Quaternion.identity);
	Materials.CheckMat = true;

Please answer code with Unity JS

thanks in advance

So basicaly you want ChosenPosition to be different than ChosenPrefab?
If so try this:


A better way without using while() or other loops

var ChosenPosition : int = Random.Range(0 , PositionsList.Count);
var ChosenPrefab : int = (ChosenPosition + Random.Range(1 , PrefabsList.Count )) % PositionsList.Count;