You are here: Re: Looking for a PHP PIN Number generator « PHP Programming Language « IT news, forums, messages
Re: Looking for a PHP PIN Number generator

Posted by Jerry Stuckle on 08/02/05 19:25

mydejamail@yahoo.co.uk wrote:
> Looking around the web I see all sorts of theories for generation
> random numbers, some of which sound pretty complicated.
>
> Does PHP's simple command, generate something truly random?
>
> If I generate a range of 16 digit numbers, what chances are there for a
> repetition over the whole 10^16 range?
>
> I think my demands are over the top here, I don't know if my computer
> can generate that number I just want to have the warm feeling that it
> won't be possible in my lifetime.
>

It's pretty random, especially if you are generating these at different times
and seed the generator based on the current time. Then you can use general
statistics functions. I wrote a quick program to check, and it showed you would
have to generate 117,741,003 random numbers to have a 50% chance of getting a
duplicate.

Now - if you're trying to generate them all at the same time based on one seed,
the probability might be somewhat less, but shouldn't be that much.

BTW - who cares if there are duplicates? For instance - my bank assigns a 4
digit PIN for my ATM card. And I KNOW they have more than 10,000 users out
there. There are a lot of duplicates.

PINs don't need to be unique - just long enough that they can't be guessed
easily. And I don't think someone's going to guess a 16 digit PIN in any
reasonable time, even if it is computer generated. And you could always lock
them out after 1,000,000 consecutive failures :-).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация