82
编辑日期: 2024-11-28 文章阅读: 次
@author jackzhenguo
@desc
@date 2019/5/1
82 10个均匀分布的坐标点
random模块中的uniform(a,b)
生成[a,b)内的一个随机数。
如下生成10个均匀分布的二维坐标点
from random import uniform
In [1]: [(uniform(0,10),uniform(0,10)) for _ in range(10)]
Out[1]:
[(9.244361194237328, 7.684326645514235),
(8.129267671737324, 9.988395854203773),
(9.505278771040661, 2.8650440524834107),
(3.84320100484284, 1.7687190176304601),
(6.095385729409376, 2.377133802224657),
(8.522913365698605, 3.2395995841267844),
(8.827829601859406, 3.9298809217233766),
(1.4749644859469302, 8.038753079253127),
(9.005430657826324, 7.58011186920019),
(8.700789540392917, 1.2217577293254112)]