In Python, the way to get a random number is roughly the following:
#-*-Coding:utf-8-*-# Specify the encoding, otherwise the following Chinese comment is not run through import random # imports random# python takes a random floating-point number 0 to 1, a = Random.random () print A # <span style= "font-family:arial, Helvetica, Sans-serif;" Using random in >python to obtain a range of (10 to 20) random floating-point numbers B = Random.uniform (ten) print b# python takes random integers in a range (10 to 20) using random c = Random.randint (10,20) Print C # Python takes a random value from the list collection using random lists = [5, ' Hello ', 9, ' Xiong_it ', 3, ' Python ']d = Random.choice (list) print d</span>
original link : http://blog.csdn.net/xiong_it/article/details/45225581
get the random number method in Python summary as above, if not all, welcome to fill the knife .
Python:random get random number usage notes