Python Random getrandbits() နည်းလမ်း
ဥပမာ
8 bits အရွယ် ကိန်းပြည့်ကို ပြန်ပေးပါ-
import random
print(random.getrandbits(8))
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
နည်းလမ်း သည် getrandbits()
သတ်မှတ်ထားသော အရွယ်အစား (ဘစ်များ) တွင် ကိန်းပြည့်ကို ပြန်ပေးသည်။
အထားအသို
random.getrandbits(n)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
n | Required. A number specifying the size, in bits, of the returned integer. |