numpy.random.random_sample()
— one of the functions for random sampling in numpy. It returns an array of the given shape and fills it with random floating point numbers in the halfopen interval [0.0, 1.0).
Syntax: numpy. random.random_sample (size = None)
Parameters:
size: [int or tuple of ints, optional] Output shape. If the given shape is, eg, (m, n, k), then m * n * k samples are drawn. Default is None, in which case a single value is returned.Return: Array of random floats in the interval
[0.0, 1.0).
or a single such random float if size not provided.
Code # 1:

Output:
Output random float value: 0.9211987310893188
Code # 2:
# Python program explaining
# numpy.random.random_sample () function
# numpy import
import
numpy as geek
# output array
out_arr
=
geek.random.random_sample (size
=
(
1
,
3
))
print
(
"Output 2D Array filled with random floats:"
, out_arr)
Output:
Output 2D Array filled with random floats: [[0.64325146 0.4699456 0.89895437]]
Code no. 3:

Output:
Output 3D Array filled with random floats: [[[0.78245025] [0.77736746]] [[0.54389267] [0.18491758]] [[0.97428409] [0.73729256]]]
The field of Artificial Intelligence (AI), which can definitely be considered to be the parent field of deep learning, has a rich history going back to 1950. While we will not cover this history in mu...
23/09/2020
This book is an indispensable guide focuses on Machine Learning and R Programming, in an instructive and conversational tone which helps them who want to make their career in Big Data Analytics/ Data ...
10/07/2020
Target knows. Apple Computer knows, too. So do LinkedIn, Netflix, Facebook, Twitter, Expedia, national and local political campaigns, and dozens of other organizations that all generate enormous eco...
10/07/2020
We are experiencing a renaissance of artificial intelligence, and everyone and their neighbor wants to be a part of this movement. That’s quite likely why you are browsing through this book. There a...
23/09/2020