|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Algorithm?
Can't find the algorithm's forum guess it was removed?
I am looking for some script to create a random unique identifying number in this type of format 1234567-28 basically 7 random digits, then a number that is derived somehow by those digits. either adding them up, or factoring in the system time somehow to make it truely random. any ideas are welcome.
__________________
-Sotonin |
|
#2
|
|||
|
|||
|
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
||||
|
||||
|
Unlike this post, which was not renamed, but moved. To the Algorithms forum.
![]()
__________________
Give a person code, and they'll hack for a day; Teach them how to code, and they'll hack forever. Analyze twice; hack once. The world's first existential ITIL question: If a change is released into production without a ticket to track it, was it actually released? About DrGroove: ITIL-Certified IT Process Engineer - Enterprise Application Architect - Freelance IT Journalist - Devshed Moderator - Funk Bassist Extraordinaire |
|
#4
|
|||
|
|||
|
lol
|
|
#5
|
|||
|
|||
|
Re: Algorithm?
Quote:
Random and Unique? If it's truely random then it won't be unique. If it's truely unique then it won't be random... ![]() |
|
#6
|
|||
|
|||
![]() And if it comes from a software algorithm, it is not random either. You need special hardware for true random numbers. hth, M. |
|
#7
|
|||
|
|||
|
hmm ok. well, scratch the unique part.
What are some simple ways to generate this in php? And what should I base the last digits on? I know this is a php question. why i put it in PHP in the first place. but o well it was moved. |
|
#8
|
||||
|
||||
|
Use the mhash() and bin2hex() functions perhaps? See
http://www.php.net/manual/en/function.mhash.php for more. You can perhaps pass the current time to mhash(), to generate a unique key and then bin2hex the result to convert to hex digits: $key = bin2hex(mhash(MHASH_MD5, time()));
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > Algorithm? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|