• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need an auto generation logic

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need a random sequence generation logic. The sequence can be in the format
(2 alphabets with 1 digit) * n times
for eg :
RT2YU4JK7
PO6HJ2KA9RW3

Any pointers to help me in generating such a kind of sequence in java?

Thanks,
Neelima
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it always "letter letter digit", or can the digit also appear elsewhere? If it is the former then it's quite easy, considering that letters are chars and chars can be treated as ints. Math.random() or java.util.Random can then help:
The digit can be generated similarly except without the last step: Use a StringBuilder to add these all together, then at the end call toString().

Now, if the digit can appear anywhere then it's a bit harder but I'm sure you'll be able to work it out using my example code.
 
Neelima Mohan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks a bunch!
yes the sequence is specific to what I wrote...its only in <letter letter digit> form.
I will just work it out and see.
Your input has been very helpful

Thanks,
Neelima
 
Rob Spoor
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic