Random Enum Entry?

I’m trying to get a random return from an enum. Everything I’ve found on-line so far doesn’t work. This is my last effort which doesn’t work:

The last index node always returns 0. I don’t know why that 0 appears in the ‘Make Array’ node, but I can’t make it go away no matter what I do. This always gives the first name in the enum. Even hard coding the length of the array into the RNG doesn’t work. It still always returns the first entry in the enum. Can someone help me out here?

Thanks

You need more than one enum to get higher than zero.

@clockworkocean

I’m sorry, I must be misunderstanding you. Your answer makes it seem like you don’t know what an Enum is or perhaps we’re crossing wires. I don’t want to get a random Enum from an array of Enums, I want to choose a random entry from a single Enum.

Hey Lord_Volkner,

The Make Array Node from your Picture does not what you think it does.
it creates an array with just one Item (which is the one Enum entry that your Variable holds).

what you can do is the folowing:

there is a node to get the number of Entrys in your enum and you can convert that index to a byte than there is another node for your Enum to get the entry convertet from that byte.

3 Likes

@ReneB

That got it, thank you.