0
    enum Heroes {
        batman,
        superman,
        spiderman
    }
Heroes hero = uint8(random % 3);

Error: Type uint8 is not implicitly convertible to expected type enum Heroes.

How do I get a random enum?

1 Answer 1

0

You can do something like this

Heros hero = Heros(random % 3)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.