Printivity interview question

Write a random function algorithm using any language or pseudocode.