没有输入参数的numpy.random.random()函数| 使用Python的线性代数

Numpy is the library of function that helps to construct or manipulate matrices and vectors. The function numpy.random.random() is a function used for generating a random value between 0 and 1. This function has a huge application in machine learning and probability.

Numpy是一个功能库,可帮助构造或操纵矩阵和向量。 函数numpy.random.random()是用于生成0到1之间的随机值的函数。此函数在机器学习和概率中具有巨大的应用。

Syntax:

句法:

    random_value = numpy.random.random()

Input parameter(s): None.

输入参数:无。

Python代码演示numpy.random.random()函数的示例 (Python code to demonstrate example of numpy.random.random() function)

# Linear Algebra Learning Sequence 
# numpy.random.random() function to 
# get a random value

import numpy as np

print("\n--Printing a set of 15 random numbers with range 0 to 1--\n")

for i in range(15):
    print('Random Value',i+1,' :', np.random.random())

Output:

输出:

--Printing a set of 15 random numbers with range 0 to 1--

Random Value 1  : 0.706190689849706
Random Value 2  : 0.04614551250974097
Random Value 3  : 0.13004947242111353
Random Value 4  : 0.11031031469193309
Random Value 5  : 0.6427980624326431
Random Value 6  : 0.3013274621110915
Random Value 7  : 0.40619616687836857
Random Value 8  : 0.6804665240893712
Random Value 9  : 0.7663192165667464
Random Value 10  : 0.5489087055243076
Random Value 11  : 0.8196093405417416
Random Value 12  : 0.8370083293699818
Random Value 13  : 0.1945776676106037
Random Value 14  : 0.2760592260482946
Random Value 15  : 0.31670529527628843


翻译自: https://www.includehelp.com/python/numpy-random-random-function-with-no-input-parameter-linear-algebra-using-python.aspx

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值