I ran into a problem with the PHP execute code, it was throwing an error, I do not know exactly why, and of course I can't get it to repeat now to capture the error message...
Also it was a bit slower. replacing (for capital letters) Char(Random%($CapEnd-$CapStart+1))+$CapStart) -- (656 seconds for 100,000) with PHP Execute("";"mt_rand";$Result;$CapStart;$Capend) -- (709 seconds for 100,000) Char($Result) resulted in an approximately 10% increase in execution time over 100,000 iterations. Also.. for this type of usage - I am not sure that it really matters. 1 - we are significantly restricting the random number range 2 - Since this is for passwords, all that really matters is that it is better then "1111" :) On Mon, 26 Jun 2017 14:46:36 -0400, Jim Medlen via 4D_Tech wrote: > > > Tim, > > Thanks for the help. > > I think that my method was based on your original tech note > http://kb.4d.com/assetid=76055 > > I found the PHP command mt_rand which generates a random number using > Mersenne Twister. > This function was recommended on several web pages regarding random number > generators. > > Using vbOK:=PHP Execute("";"mt_rand";vi1;1;36) in place of > vi1:=(Random%35)+1 works well. > > It is fast and has not created any collisions with existing passwords in > initial testing. > > vText:="" > vtSet:="abcdefghijklmnopqrstuvwxyz0123456789" > > For (vi2;1;8) > //vi1:=(Random%35)+1 > vbOK:=PHP Execute("";"mt_rand";vi1;1;36) // Mersenne > Twister > vText:=vText+vtSet[[vi1]] > End for > > > Thanks, > > Jim Medlen > Computer & Information Systems > Functional Devices, Inc. > j.med...@functionaldevices.com > phone (765) 883-5538 x 428 > fax (765) 883-4262 > http://www.functionaldevices.com > This email was transmitted on 100 percent recycled electrons > > > > Confidentiality Notice: > The information transmitted is intended only for the person or entity > to which it is addressed and may contain confidential and/or > privileged material. If the reader of this message is not the intended > recipient, you are hereby notified that your access is unauthorized, > and any review, dissemination, distribution or copying of this message > including any attachments is strictly prohibited. If you are not the > intended recipient, please contact the sender at (800) 888-5538 and > permanently delete the original and any copy including printed copies > of this e-mail and any attachments. > > > > > > On 6/26/17, 12:54 PM, "Timothy Penner" <tpen...@4d.com> wrote: > >>> Is the 4D Random function considered a good random number generator ? >> >> It's OK, it produces a 15-bit random number between 1 and 32,767. >> If you need numbers above 32,767 you can use this: >> http://kb.4d.com/assetid=77777 >> >> If the built in command doesn't meet your need then you can use PHP (like >> David said). >> >> There is also this plugin: https://github.com/miyako/4d-plugin-PRNG >> >>> I concatenate 8 characters to build a ³random² password which then has >>> to meet a few simple rules. >> >> I wrote this tech tip 7 years ago, maybe it will help: >> http://kb.4d.com/assetid=76055 >> >> -Tim PENNER >> >> >> Timothy Penner >> Technical Services Engineer >> >> 4D Inc >> 95 S. Market Street, Suite #240 >> CA 95113 San Jose >> United States >> >> Telephone : +1-408-557-4600 >> Standard : +1-408-557-4600 >> Fax : +1-408-271-5080 >> Email : tpen...@4d.com >> Web : www.4D.com >> >> > > > ********************************************************************** > 4D Internet Users Group (4D iNUG) > FAQ: http://lists.4d.com/faqnug.html > Archive: http://lists.4d.com/archives.html > Options: http://lists.4d.com/mailman/options/4d_tech > Unsub: mailto:4d_tech-unsubscr...@lists.4d.com > ********************************************************************** --------------- Gas is for washing parts Alcohol is for drinkin' Nitromethane is for racing ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************