Random code links on iframes

I am a complete corvid novice who needs help.

My website has different pages for different types of puzzle and each puzzle is embedded into an iframe on that page. I need the puzzles to change regularly so am looking to automate this. I don't mind how this happens whether randomly or from criteria (such as a date or a theme).
Can this be done simply?

So pick up a random puzzle using Math.random()
and post it to the iframe:
https://www.wix.com/corvid/reference/$w/htmlcomponent/postmessage