VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse Community Snippets›Devices·Up to Community Snippets · Devices·18 of 70 in Devices

Opt-In Selection Pool Device

21,095 Views

Report

  • 
    using { /Fortnite.com/Characters }
    using { /Fortnite.com/Devices }
    using { /UnrealEngine.com/Temporary/Diagnostics }
    using { /Verse.org/Random }
    using { /Verse.org/Simulation }
    
    # Selects a random subset of Count elements from Elements and returns an array of the selected elements.
    # If Count is greater than the number of elements in Elements, all elements are returned in a random order.
    # This function uses parametric types, a feature of Verse. Parametric types allow you to specify arguments without a specific type.
    # This means that expressions can be more "generic" and operate on the arguments as long as those operations are supported by the type.
    # In this case, we don't need to know the type of each element in Elements to operate on the array, so we can use Shuffle and Slice on any type "t".
    # For more information, see https://dev.epicgames.com/documentation/en-us/uefn/Verse/parametric-types-in-verse
    SelectRandomElements<public>(Elements:[]t, Count:int where t:type):[]t=
        # Shuffle the Elements so they're in random order when we pick them.
        RandomElements := Shuffle(Elements)
        # Slice returns an array from StartIndex (first argument) to StopIndex (second argument).
        # Since the elements are in random order, this will return a random subset of Count elements from the start.
        if (Selection := RandomElements.Slice[0, Count]):
            Selection # If the Slice operation succeeds this is the last expression of the function, which is used as the implicit return.
        else:
            # If there are less than Count elements in the array, return all elements. They'll be in random order.
            RandomElements

You're reading a preview

The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.

Sign in with Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Devices · 18 of 70
Prev
fortnite compass device
Next
fortnite state button

Source

Epic Games documentation

View original

Last updated 2026-07-26T13:01:01.543362+00:00

VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse