lundi 17 août 2020

Does This increase Randomness of a Generatored Number?

I am new to python programming and I wrote this code as an experiment. My question is this, does this increase the randomness of a generated number or is this just wasted of code?

import random

def random_number_generator():
    """ Returns a randomized random number """

    # initialize 10 variable that will have random integers from range 1-10
    r1 = random.randint(1, 10)
    r2 = random.randint(1, 10)
    r3 = random.randint(1, 10)
    r4 = random.randint(1, 10)
    r5 = random.randint(1, 10)
    r6 = random.randint(1, 10)
    r7 = random.randint(1, 10)
    r8 = random.randint(1, 10)
    r9 = random.randint(1, 10)
    r10 = random.randint(1, 10)

    # create a list that contains the 10 random integer variables
    random_lst = [r1, r2, r3, r4, r5, r6, r7, r8, r9, r10]

    # Use the random.choice() method to randomly select 1 of the 10
    # random numbers (that are randomized 1 -10)
    res = random.choice(random_lst)

    # return results
    return res


print(random_number_generator())

Again my question is, does this increases the randomization of a generated number or is it no more random than just applying random once? Thanks in advance for any helpful advice or info.




Aucun commentaire:

Enregistrer un commentaire