code: def query_cat_random(catid, **kwargs):
          '''
          Get random lists of certain category.
          '''
          num = kwargs.get('limit', 8)
          if catid == '':
              rand_recs = TabPost.select().order_by(peewee.fn.Random()).limit(num)
          else:
              rand_recs = TabPost.select().join(
                  TabPost2Tag,
                  on=(TabPost.uid == TabPost2Tag.post_id)
              ).where(
                  (TabPost.valid == 1) & (TabPost2Tag.tag_id == catid)
              ).order_by(
                  peewee.fn.Random()
              ).limit(num)
          return rand_recf query_cat_random(catid, **kwargs):
          '''
          Get random lists of certain category.
          '''
          num = kwargs.get('limit', 8)
          if catid == '':
              rand_recs = TabPost.select().order_by(peewee.fn.Random()).limit(num)
          else:
              rand_recs = TabPost.select().join(
                  TabPost2Tag,
                  on=(TabPost.uid == TabPost2Tag.post_id)
              ).where(
                  (TabPost.valid == 1) & (TabPost2Tag.tag_id == catid)
              ).order_by(
                  peewee.fn.Random()
              ).limit(num)
          return rand_recs
docs: Get random lists of certain category.