added random code generation