UKismetArrayLibrary::Array_ShuffleFromStream
#include "Kismet/KismetArrayLibrary.h"
Access: public
Specifiers: staticBlueprintCallableCustomThunk
Description
Randomizes the order of the elements in an array in place, drawing randomness from the given FRandomStream for deterministic results.
Caveats & Gotchas
- • The header notes this exists specifically 'to achieve determinism' — reusing the same RandomStream seed will reproduce the same shuffle order given the same input array.
- • RandomStream is passed by reference and its internal state advances as a side effect of the shuffle; calling this again with the same stream produces a different shuffle order, not the same one.
Signature
static void Array_ShuffleFromStream(UPARAM(ref) TArray<int32>& TargetArray, UPARAM(Ref) FRandomStream& RandomStream); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetArray | UPARAM(ref) TArray<int32>& | The array to shuffle in place. | — |
| RandomStream | UPARAM(Ref) FRandomStream& | The random stream driving the shuffle, for deterministic/reproducible results. | — |
Return Type
void Example
Deterministic shuffle for replay-safe randomness C++
FRandomStream Stream(12345);
TArray<int32> Values = {1, 2, 3, 4, 5};
UKismetArrayLibrary::Array_ShuffleFromStream(Values, Stream); See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?