Doubt regarding the seed function

can u tell me more about the seed function as in the video prateek bhaiya has numbers as (7,8,7) by the seed function but I have 10 numbers coming each time I am running the seed function so why is it so

Hey @bhavyahoda, I would request you to go through this link to understand the seed function better. Seed function is basically used to save the state of a random function, so that it can generate same random numbers on multiple executions of the code.

To check why you are getting 10 numbers, I will have to look at your code (as seed function doesn’t increase the size of the array in any case. ) I request you to please share the link to your code :+1:

Hope this helps :+1:
Happy Learning :slight_smile:

1 Like

https://drive.google.com/file/d/1flSX5CnVX5q0EIze0BoPvtGuvDSDxi_9/view?usp=sharing

Hey @bhavyahoda, this is happening because if you would observe sir has run the following code first :

a=np.random.randint(5,10,3)
print(a)
#so this return 3 random integers from range 5 to 10 in which 5 is inclusive

and after this sir executes this cell :

np.random.seed(1)
np.random.shuffle(a)
print(a)

That’s why sir is getting 3 values and you are getting 10. Remember the sequence of execution of cells matter a lot. I hope this clears your doubt :slight_smile:

If you still have any, you can contact me anytime :+1:
Happy Learning :slight_smile:

1 Like

yeah right thank u so much

Happy to Help :slight_smile:

All the best :+1:

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.