If you want to generate a random number, you'll have to write custom code. Alternatively, qRules has a GenerateNumber function which you can use to generate a random ID without having to write your own code.
More on qRules: http://www.qdabra.com/en/products/qRules_new.aspx