Tutorials Point


  Python Basics
  Python Advanced
  Python Useful References
  Python Useful Resources
  Selected Reading

© 2011 TutorialsPoint.COM


  Home     References     Discussion Forums     About TP  

Python Number uniform() Function


previous next AddThis Social Bookmark Button


Description:

This function returns a random float r, such that x is less than or equal to r and r is less than y

Syntax:

uniform(x, y)

Note: This function is not accessible directly so we need to import uniform module and then we need to call this function using random static object.

Parameters:

Here is the detail of parameters:

  • x: Sets the lower limit of the random float

  • y: Sets the upper limit of the random float

Return Value:

Reshuffled list.

Example:

#!/usr/bin/python
import random

print "Random Float uniform(5, 10) : ",  random.uniform(5, 10)

print "Random Float uniform(7, 14) : ",  random.uniform(7, 14)

This will produce following result:

Random Float uniform(5, 10) :  5.52615217015
Random Float uniform(7, 14) :  12.5326369199


previous next Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names