PureBlood, I didn't even know that procedure/function existed I will try that out
Sabzi, I definitely though about that, but I could never write something that complex. I cant even comprehend how I would go about doing it let alone doing it.
Sex,Speed is not a factor as long as we aren't talking minutes. Which I don't think we are. I kind of understand your idea but I'm not sure how to go about changing/choosing numbers from the array? For example if say the first number i pick from the array is 42, how do I stop 42 still being a possibility. If i remove that slot of the array, then when happens when it gets chosen? a result will return false and it will break? or if i move the item above into '42's slot but i don't know how to do that.and it would be very long winded each time a number is picked (which i think is what you were talking about.
I will look over all of these and come back with a reply some time tomorrow (i have a geog GCSE tomorrow at 9:00 am)
EDIT: DeleteValueInIntArray(NumbArray, A); That is the PERFECT procedure.
Problem:
Procedure ShuffleCards;
var
NumbArray : TIntegerArray;
I, A: Integer;
begin
setlength(NumbArray, 51);
for i := 0 to high(numbarray)do
numbarray[i] := i;
for i := 0 to High(Card) do
begin
A := Random(High(NumbArray));
Card[i].Position := NumbArray[A];
DeleteValueInIntArray(NumbArray, A);
end;
End;
Each cards position is now reading 0 every time.
This is the setup of the variables/arrays
type
TCard = record
Suite: string ;
Number: Integer ;
Position: Integer ;
end;
var
Card: array of TCard;
If someone can help with a solution i would be extremely grateful as i'm a little to tired to figure it out now.