How can I generate random numbers inside my shortcodes on each implementation?

According to @Mark Kaplun comment:

Make your getRandomCode() return value instead of echo like this

function getRandomCode(){
    $alphanumeric = "0123456789abcdefghijklmnopqrstuvwxyz";
    $su = strlen($alphanumeric) - 1;
    // echo '<br/>';
    // // echo rand(0, $su);
    // // echo '<br/>';
    // // echo substr($alphanumeric, rand(0, $su), 3);
    // // echo '<br/>';
    return substr($alphanumeric, rand(0, $su), 3) .
            substr($alphanumeric, rand(0, $su), 2).
            substr($alphanumeric, rand(0, $su), 1).
            substr($alphanumeric, rand(0, $su), 1);
}

and remember do not make change to your shortcode callback