Is there a way to generate a random number as a passcode?

My student is building an escape room and wants to build code that will enable the user to do the escape room multiple times but with a new passcode every time.

Can this be done?

Hi @DavisTech,

Yes, CoBlocks has two random number generator blocks under Operators. Here’s an example of how a random 4-digit passcode could be created:

Note that this requires turning on Advanced CoBlocks, by clicking the Settings cog wheel at the bottom of the CoBlocks categories, in order to use the create string with block.

Hope this helps! Let me know if you have any further questions. If this solves your problem, please mark this post as the Solution.

Many thanks,
Geoff @ TechLeap

3 Likes