How to create RANDOM Numbers in Python?
DATA MUNGING DATA CLEANING PYTHON MACHINE LEARNING RECIPES PANDAS CHEATSHEET     ALL TAGS

How to create RANDOM Numbers in Python?

How to create RANDOM Numbers in Python?

This recipe helps you create RANDOM Numbers in Python

0

Recipe Objective

Many a times we need a random number so how we can get it?

So this is the recipe on how we can create RANDOM Numbers in Python.

Step 1 - Loading Library

We have imported numpy which is needed. import numpy as np

Step 2 - Generating Random Numbers

We have generated a few random number numbers with the help of function np.random we have used a attribute normal to make sure that it comes from a normal distribution. print(np.random.normal()) print(np.random.normal(size=14)) print(np.random.uniform(size=14)) print(np.random.randint(low=1, high=100, size=14)) So the output comes as

0.13675095711660307

[-1.5024633   0.36342989  0.70793256 -0.9789945   0.61796606  0.98637534
  1.32068877  1.81571864  0.23038631  0.65866147  0.7082002   0.01925767
  1.94746162 -1.38092815]

[0.16054208 0.00366705 0.03862502 0.27800544 0.32018415 0.95070521
 0.34582893 0.40153549 0.37467516 0.36899577 0.47037688 0.74223317
 0.18082368 0.9568694 ]

[83 48 72 16 89 80  6 17 71 59 52 56 87 45]

Relevant Projects

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Solving Multiple Classification use cases Using H2O
In this project, we are going to talk about H2O and functionality in terms of building Machine Learning models.

Natural language processing Chatbot application using NLTK for text classification
In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

Predict Credit Default | Give Me Some Credit Kaggle
In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

Deep Learning with Keras in R to Predict Customer Churn
In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

Zillow’s Home Value Prediction (Zestimate)
Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Music Recommendation System Project using Python and R
Machine Learning Project - Work with KKBOX's Music Recommendation System dataset to build the best music recommendation engine.

Customer Market Basket Analysis using Apriori and Fpgrowth algorithms
In this data science project, you will learn how to perform market basket analysis with the application of Apriori and FP growth algorithms based on the concept of association rule learning.

Learn to prepare data for your next machine learning project
Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.