Or look at mx.utils.UIDUtil. From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Tracy Spratt Sent: Monday, January 05, 2009 2:46 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Generating Random key
Yeah, to get that specific format, you will need to do a bit of work. I'd suggest googling: actionscript generate random string. I found: http://www.zedia.net/2008/generate-random-strings-in-as2-or-as3/ Use Brendan's suggestion, or roll your own. Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of Brendan Meutzner Sent: Monday, January 05, 2009 5:25 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] Generating Random key I'm sure someone will inevitably suggest a better method, but the following would do the trick: 1) Create UID with UIDUtil.createUID() 2) Strip '-' symbols / Strip vowels 3) Truncate to 12 characters (if there weren't enough after stripping vowels, just repeat steps 1 and 2 and append to current string and truncate again) 4) reintroduce '-' where needed in pattern you indicated. Brendan On Mon, Jan 5, 2009 at 4:19 PM, anuj181 <anuj...@gmail.com<mailto:anuj...@gmail.com>> wrote: Hi I need to work on a piece of code in which whenever user clicks on the button , the code should generate random 12 character key having all caps and no vowels in the format of XXX-XXX-XXX-XXX. Can anybody guide me in this direction. Is there any built in function for that or do I have to use my own logic for random generation in this specific case. Any help will be appreciated. Thanks Anuj -- Brendan Meutzner http://www.meutzner.com/blog/