Python Numpy Random Array

Publié le: 29 août 2018
sur la chaîne: Python Marathon
5,869
36

Descargar el Código: patreon.com/pythonmaraton

Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! Generally, for an array with random values in the range [a,b] you have (b-a)*np.random.random(())+a.

This video shows you how to use np.random.random(()) to create random arrays of size n with entries between any numbers you desire.

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.

✅Subscribe:    / @pythonmaraton  

📺Channel:    / @pythonmaraton  

▶️Watch Latest Python Content:    • Python String Slice and List Slice  

▶️Watch Latest Other Content:    • Video  





RANDOM ARRAY

In this video let me show you some examples of how to create random matrices in python.

We import numpy as np and random

First just type np.random.ranom and then enter a tuple with the size of the disred random matrix. It will automatically create a matrix with entries between 1 and 0

If we want to change the value range, we can multiply by twice the value desired and then subtract the value desired from the end

So if we want entries between -5 and 5 we multiply by 10 and minus 5.

So if you think about it this way, the max number it could be is 10 - 5 = 5 and the min number it could be is 0 - 5 = -5

So if we want entries between -100 and 100 we multiply by 200 and minus 100.

So if you think about it this way, the max number it could be is 200 - 100 = 100 and the min number it could be is 0 - 100 = -100

There you have it, that is how you create random arrays in python

#PythonMarathon #LearnPython #PythonTutorial


Sur cette page du site, vous pouvez voir la vidéo en ligne Python Numpy Random Array durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Python Marathon 29 août 2018, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 5,869 fois et il a aimé 36 téléspectateurs. Bon visionnage!