Python‎ > ‎random‎ > ‎

random.Random()

http://www.adilwaseem.com/

Introduction
Used to instantiate instances of Random to get generators that don't
share state.

Syntax
random.Random()->random value

Parameters
None

Example
The tkinter Button generated the Random number through Random.random() method.
 >>> from tkinter import*
>>> master=Tk()
>>> def Random_number():
                import random
                random1=random.random()
                print(random1)
>>> button=Button(master, text="Generate Random Number", command=Random_number).pack()





>>> 0.3113241804334048
0.5353597978093854
0.6206780899289036
0.1329108837599009
0.09253008814720265
0.7965295953913955
0.5464788670836471
0.05573566853264078
0.5957291155959824
0.5136834489919084
0.24383631011415896
0.8615995927200537


The method returns with the value:
import random
x=random.Random()
if x.__ge__(2):
                    print("Random value are not acceptable")
else:
     print(x)
>>> 
Random value are not acceptable
>>>
Comments