Hello,
Can someone help me with a function that will generate a random string / password?
Any help will be much much appreciated!
Thanks,
Cherry
These forums are CLOSED. Please visit the new forums HERE
random string generator |
|
|
Cherry Paisley
Registered User
Join date: 27 Oct 2006
Posts: 1
|
12-30-2006 20:12
Hello,
Can someone help me with a function that will generate a random string / password? Any help will be much much appreciated! Thanks, Cherry |
|
Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
|
12-30-2006 22:44
Hi Cherry,
This function will generate a random password of letters and numbers for you - I hope this is what you are looking for: CODE
Some details: - this will generate a random password that has a length anywhere between the two parameters passed into it. - each password begins with an alphabetic character, followed by any alphanumeric characters - it's not case sensitive: it only spits out lowercase letters - it should be easily modifiable if you want to include uppercase letters or other characters (like underscores) just add them to the list "vPasswordCharacters" - it uses llFrand, so it's probably "pseudo-random" as opposed to purely random - this includes no error error checking: try passing negative parameters and you probably won't get results that you are happy with! just keep the vMaxPasswordLength parameter larger than the vMinPasswordLength parameter, and everything should work fine |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-31-2006 02:39
Switch to using a straight string and llGetSubString rather than a list for the encryption characters would be more efficient in terms of memory usage.
|
|
Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
|
12-31-2006 09:42
Switch to using a straight string and llGetSubString rather than a list for the encryption characters would be more efficient in terms of memory usage. Yeah - I figured as much. I forgot to mention that my method was probably not the most efficient, but forgot to add that in! (I'm still quite new to scripting and was just happy to be able to do it!) |
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
12-31-2006 09:47
Yeah - I figured as much. I forgot to mention that my method was probably not the most efficient, but forgot to add that in! (I'm still quite new to scripting and was just happy to be able to do it!) You solution is reasonable just not how I would do it .You could also have used llListRandomize rather than select the letters teh way you did. |
|
Edison Swain
Registered User
Join date: 7 Dec 2006
Posts: 51
|
12-31-2006 10:22
You solution is reasonable just not how I would do it .You could also have used llListRandomize rather than select the letters teh way you did. That was my first thought, but I believe that won't allow for repeating characters. For example, you'd never end up with "eg7tt7g" or something like that. Not that it probably matters though, since forcing it to be, say, 8 characters out of the 36 possible will still give around a trillion different possibilities without repeating characters. |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
12-31-2006 14:22
CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
01-01-2007 12:11
See the wiki page on Frand
It is not random and will give you the same sequence after a reset. |
|
Sterling Whitcroft
Registered User
Join date: 2 Jul 2006
Posts: 678
|
01-01-2007 19:50
Can you add llGetTimestamp to Frand to generate an (approximate) random seeded number?
or at least one that doesn't repeat? |
|
Peekay Semyorka
Registered User
Join date: 18 Nov 2006
Posts: 337
|
01-01-2007 21:51
It is not random and will give you the same sequence after a reset. No, llFrand will not give the same sequence after a script reset, so in effect it is internally seeded. -peekay |
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
01-02-2007 13:44
See the wiki page on Frand It is not random and will give you the same sequence after a reset. That information was factually inaccurate and was removed from the wiki. Please read the revised page: http://lslwiki.com/lslwiki/wakka.php?wakka=llFrand Test script to illustrate: CODE
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey |