RealDocs

UKismetArrayLibrary::Array_Shuffle

function Engine Blueprint Since unknown
#include "Kismet/KismetArrayLibrary.h"
Access: public Specifiers: staticBlueprintCallableCustomThunk

Description

Randomizes the order of the elements in an array in place using the engine's global random stream.

Caveats & Gotchas

  • Uses the engine's global RNG (FMath::Rand-based), not a seeded FRandomStream — use Array_ShuffleFromStream if you need a deterministic, reproducible shuffle.
  • Shuffles in place and mutates TargetArray directly; there is no non-mutating overload that returns a shuffled copy.

Signature

static void Array_Shuffle(UPARAM(ref) TArray<int32>& TargetArray);

Parameters

Name Type Description Default
TargetArray UPARAM(ref) TArray<int32>& The array to shuffle in place.

Return Type

void

Example

Shuffle a deck of card indices C++
TArray<int32> Deck;
for (int32 i = 0; i < 52; ++i) { Deck.Add(i); }
UKismetArrayLibrary::Array_Shuffle(Deck);

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.