🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #8118

How to check if random password is unique ??

#8118
From: Russell
Date: Thu, 19 Apr 2001 10:55
22 lines
1388 bytes
  Hi all ,
  I am using RedHat6.1 and jdk1.3.

  I have code below :

  public void generatePassword(){

   StringBuffer strbuff = new StringBuffer();

   for(int i = 0 ; i < 6 ; i++){
     
strbuff.append(alphabets.charAt((int)(Math.random()*(alphabets.length()
- 1))));
    }
  }

  As you all know ,the code below random generate password . However how
i am going to check if the generate password is
  unique if the code is run by two threads ??

  Anybody have any ideas ?? Thanks wt.
Technical Details
Message-ID: <3ADEC40F.88A0B489@cesmainternational.com>
Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,ce64f4cb2825b970,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-04-19 04:08:03 PST
Message-ID: <3ADEC40F.88A0B489@cesmainternational.com>
Date: Thu, 19 Apr 2001 18:55:11 +0800
From: Russell <weetat@cesmainternational.com>
X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.2.13-0.13 i686)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: How to check if random password is unique ??
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 203.126.155.39
X-Trace: dnews 987677151 203.126.155.39 (19 Apr 2001 03:45:51 -0700)
Lines: 22
Path: arc1-ca.pugleaf.net!supernews.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed1.uni2.dk!newssuck.uni2.dk!dnews