+ Reply to Thread
Results 1 to 2 of 2

Random string generator is not random

  1. #1
    Registered User
    Join Date
    09-21-2023
    Location
    Poland
    MS-Off Ver
    365
    Posts
    1

    Random string generator is not random

    Hi,

    I have a code (written with help of chatgpt ) which is supposed to generate random 6-character string out of small letters and digits.
    So there is 26 letters and 10 digits so in total 36 different characters. Length of 6 gives 36 ^ 6 = 2.176.782.336 possible combinations.
    Somehow, with only a little over 2000 runs I got 31 repeat codes, 29 repeat twice and to repeat 3 times which is statistically almost impossible. I first thought it was just one which could be like 0,1% chance but not 30.
    Any idea what is causing it? I run this in a loop of 10.000 twice and was not able to get repeat code. This is a part of a bigger tool which is run by different people and these repeats were created in a timespan of about 3 months, some repeat were 1, 2, 3 months apart and some weeks or days.
    I will probably just write all codes to some txt and each time append it by new code and check if it exists to make sure it is for sure unique but this should not happen, I am interested in why this happened from technical side.

    Any ideas?

    Also - the code has a check if it isn't all digits if it is, then it changes last character to letter "q", it was just a temporary solution and will probably change that to just run again in that case. Digits appearing twice in the characters list are because there was over 2 times more letters so they were far more common so just wanted to make the codes have even number of letters and digits.

    Thanks in advance for all answers


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: Random string generator is not random

    Hi try this

    Please Login or Register  to view this content.
    Last edited by JEC.; 09-21-2023 at 11:18 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Random name generator.
    By Andre St-Jean in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 12-12-2022, 08:52 PM
  2. [SOLVED] Random number generator not always generating random numbers
    By Murman01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-03-2021, 05:29 PM
  3. Help adjust existing random string generator Macro
    By Satelliteexcel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-03-2019, 05:46 PM
  4. Replies: 6
    Last Post: 02-20-2019, 12:47 AM
  5. [SOLVED] Random name generator
    By TrainerJ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 01-16-2019, 05:42 PM
  6. Need help removing all symbols from a random string generator...
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-12-2013, 03:48 PM
  7. Replies: 5
    Last Post: 06-21-2013, 10:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1