rosuav at gmail
May 9, 2012, 12:44 AM
Post #3 of 4
On Wed, May 9, 2012 at 5:01 PM, Nikhil Verma <varma.nikhil22 [at] gmail> wrote:
> Hi All
> I want to generate a random number of 8 digits which involve 3 number and 5
(That's 3 digits and 5 letters) Pretty easy. Do you want to
distinguish between uppercase and lowercase letters?
Your current random_number function (btw, I wouldn't call it "number"
as it isn't one) is most of one possible solution. Divide it into two
parts, one part that generates the digits and another part that
generates the letters. Your 'characters' template would thus be
different for the two parts.
There are other solutions, which involve the generation of less random
numbers, but your way will work.