void ASpellDeck::Shuffle() { int64 DateInSeconds = FDateTime::Now().ToUnixTimestamp(); FRandomStream SRand = FRandomStream(); SRand.Initialize(DateInSeconds); int32 j; for (int32 i = spellDeck.Num() - 1; i > 0; i--) { j = FMath::FloorToInt(SRand.FRand()*(i + 1)); UActionCard* temp = spellDeck[i]; spellDeck[i] = spellDeck[j]; spellDeck[j] = temp; } }
void UKismetMathLibrary::SetRandomStreamSeed(FRandomStream& Stream, int32 NewSeed) { Stream.Initialize(NewSeed); }