Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet464/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   460   461   462   463   464   465   466   467   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

The ‘

random

’ module

The following table lists some of the more general methods of the random module, which

is used to generate pseudorandom numbers. It should be noted that for testing purposes it

may  be  useful  to  use  random.seed()  with  a  fixed  value  to  get  a  reproducible  set  of

apparently random numbers.

Method

(random.)

Description

seed(x)


Sets an initialising seed number for the (pseudo)random

number generator. Defaults to use the current time as the

seed. Using a fixed seed allows for the same pseudorandom

sequence to be generated.

randint(start, end)

Generates a random integer value from a specified range.

Note that the start and end of the range is included.

choice(vals)

Retrieves a random item from a list or other ordered

collection.

shuffle(vals, func)

Randomly changes the order of items in a list (or other

mutable sequence). Optional argument to specify a specific

random number [0–1] generating function.

sample(vals, num)

Randomly selects a number of items from a list or generator,

without replacement. Leaves the original list unaltered.

random()


Generates a random floating number between zero and one

(interval [0,1]), using a uniform probability distribution.

uniform(start,

Generates a random floating number from between specified




end)

bounds, using a uniform probability distribution.

normalvariate(mu,

sigma)


Generates a random numbers with a normal/Gaussian

probability distribution of specified mean and standard

deviation.


Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   460   461   462   463   464   465   466   467   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish