Download

[ADD] Get Array Random element

Hello. Please add in blueprint function “get random array element”. I try make some function, but i cant make input Universal array, only with defend type.

make your own
2adca7aa0487295410b1d447ca4951d5b736ef3d.png
ivXdV.png

Hey DCDenton,

CriErr has shown you the way to create a macro to work the way that you’ve requested. What you can do to call this macro or function at any time is to create either a Blueprint or a Macro Library. Here are a couple of links that’ll help you:

Blueprint Macro Library
Blueprint Macros and Macro Libraries
Making Macros
Macro Library UI

Thank you so much!!!

This will probably crash.
Your Max Index is (Length-1)

It won’t crash but will output None if the maximum value was output.

A macro like this one, not supposed to be fail-safe, also this one has a mistate, it should save random int as local int variable and use it as a source for outputs.

Works for me. Thanks for the info

Or even better just use “LastIndex” instead of length - 1, otherwise it won’t work if the array length is equal to 1.