how can i Create a randomly ordered array from the existing array I have? Like how can i make a new array copy elements from my old array into the new, but in a random order. this is what i have
MobileObjects[] array = new MobileObjects[3];
MobileObjects mob = new MobileObjects();
mob.name = ("Jawaharal");
mob.setPosition();
mob.id = 1;
array[0] = mob;
MobileObjects mob1 = new MobileObjects();
mob1.name = ("Willow");
mob1.setPosition();
mob1.id = 2;
array[1] = mob1;
MobileObjects mob2 = new MobileObjects();
mob2.name = ("Indira");
mob2.id = 3;
mob2.setPosition();
array[2] = mob2;
//shows whats in array
foreach (MobileObjects host in array)
{
Console.WriteLine("Name : " + host.name + " ");
Console.WriteLine("ID : " + host.id);
Console.WriteLine("Position: " + host.position[0] + " " +
host.position[1] + " " + host.position[2]);
}
}