class_docstr: Alternate random number generator using sources provided
  by the operating system (such as /dev/urandom on Unix or
  CryptGenRandom on Windows).
  
   Not available on all systems (see os.urandom() for details).
class_docstr_tok: ["Alternate","random","number","generator","using","sources","provided","by","the","operating","system","(","such","as","\/dev\/urandom","on","Unix","or","CryptGenRandom","on","Windows",")",".","Not","available","on","all","systems","(","see","os.urandom","(",")","for","details",")","."]
docstr: getrandbits(k) -> x.  Generates an int with k random bits.
docstr_tok: ["getrandbits","(","k",")","-",">","x.","Generates","an","int","with","k","random","bits","."]
code: def getrandbits(self, k):
      """getrandbits(k) -> x.  Generates an int with k random bits."""
      if k < 0:
          raise ValueError("number of bits must be non-negative")
      numbytes = (k + 7) // 8  # bits / 8 and rounded up
      x = int.from_bytes(_urandom(numbytes))
      return x >> (numbytes * 8 - k)
  
imports: from warnings import warn
  from math import log, exp, pi, e, ceil
  from math import sqrt, acos, cos, sin
  from math import tau, floor, isfinite
  from os import urandom
  from _collections_abc import Set, Sequence
  from operator import index
  from itertools import accumulate, repeat
  from bisect import bisect
  import os
  import _random
label_desc: Use image node_id 2 for calling the SystemRandom obj's underlying member method code with example usage: obj.getrandbits(k) and returns: unknown