The buckets are randomly offerred but most are not randomly generated. They are hand-picked by the devs. That is why some (like dragons) have the same cards every time.
By the same logic, some classes just don’t have buckets for certain archetypes. Maybe Reno has no mech bucket. (But I’ve never tried Mech Reno, so it’s just an expample.)
There are some cards that really mess up your bucket and treasure pool. It can be different spell schools in your starting deck, including even 1 battlecry/deathrattle minion, or the new 2 mana amalgam.
I suggest you search up “hs duels decks” and click on some links and see what treasures and buckets people get offerred depending on their starting deck. Some treasures can be targeted with +80% success rate, like when playing Frost Shaman or Mycelium Druid. Analyze their starting decks and bucket choices and you might gain some insights on the drafting algos, which will help you when making your own decks.