Here's what I've discovered about Mystery Gifts in Pokemon Stadium 2.
Similarities with GameBoy Color Infra-Red Mystery Gifts
The logic is the mostly the same between Pokemon Stadium 2 and Mystery Gift between GameBoy Color using infra-red system.
The game chooses a random item and decoration separately. The game first tries to give the decoration but you already have that decoration, you will get the item instead.
Choosing a specific item or decoration gift to send occurs in two stages. First, the game selects a set from which the gift will come. Then, it uses a part of the player's Trainer ID number to determine which gift from that set to send. (Below, bit 0 refers to the least significant bit of the Trainer ID and bit 15 refers to the most significant bit. Given the Trainer ID 32768, which translates to 1000000000000000 in binary, bit 15 is 1 and bit 0 is 0.)
The logic for determining the item given is the same as the logic for Mystery Gift between GameBoy Color using infra-red system.
See https://bulbapedia.bulbagarden.net/wiki/Mystery_Gift for more info.
Decoration Logic
The logic for determining decoration is different however.
Random number.
Range .
Gift set .
Overall rate
1st
36-255
Common
223/256
0-35
N/A (pick a 2nd number)
2nd
72-255
Uncommon
25/256
0-71
N/A (pick a 3rd number)
3rd
72-255
Rare
7/256
0-71
N/A (pick a 4th number)
4th
154-255
Very Rare
1/256
77-153
Tentacool Doll
0/256
0-76
Tentacool Doll or Pikachu Bed
0/256
Common, Uncommon, Rare and Very Rare follows a similar logic as GameBoy Color Infra-Red Mystery Gifts (using Trainer ID). The exact bit used for each item and decoration is slightly different. Check https://bulbapedia.bulbagarden.net/wiki/Mystery_Gift for the detailed list.
Upon reaching the 4th roll with 0-76, Tentacool Doll is given if Round 2 has not been unlocked and Pikachu Bed is given if Round 2 has been unlocked.
No code exists to return Unown Doll (internal decoration ID 35).
Why Tentacool Doll and Pikachu Bed are unobtainable
You may have noticed that Overall rate for Tentacool Doll and Pikachu Bed is 0/256. Here's why:
To obtain Tentacool Doll, the game must roll 0-35, 0-71, 0-71, 0-153 (assuming Round 2 hasn't been unlocked).
To obtain Pikachu Bed, the game must roll 0-35, 0-71, 0-71, 0-76 (assuming Round 2 has been unlocked).
Those sequences of numbers are not possible.
The game uses a 32-bit linear congruential generator: result = (seed * 0x19660D) + 0x3C6EF35F;
Mystery Gift logic only uses the last 8 bits of the generated random number.
The last 8 bits of the generator follows a cyclic pattern:
0,95,50,233,52,3,134,45,168,231,26,177,92,11,238,117,80,111,2,121,132,19,86,189,248,247,234,65,172,27,190,5,160,127,210,9,212,35,38,77,72,7,186,209,252,43,142,149,240,143,162,153,36,51,246,221,152,23,138,97,76,59,94,37,64,159,114,41,116,67,198,109,232,39,90,241,156,75,46,181,144,175,66,185,196,83,150,253,56,55,42,129,236,91,254,69,224,191,18,73,20,99,102,141,136,71,250,17,60,107,206,213,48,207,226,217,100,115,54,29,216,87,202,161,140,123,158,101,128,223,178,105,180,131,6,173,40,103,154,49,220,139,110,245,208,239,130,249,4,147,214,61,120,119,106,193,44,155,62,133,32,255,82,137,84,163,166,205,200,135,58,81,124,171,14,21,112,15,34,25,164,179,118,93,24,151,10,225,204,187,222,165,192,31,242,169,244,195,70,237,104,167,218,113,28,203,174,53,16,47,194,57,68,211,22,125,184,183,170,1,108,219,126,197,96,63,146,201,148,227,230,13,8,199,122,145,188,235,78,85,176,79,98,89,228,243,182,157,88,215,74,33,12,251,30,229,0
The first random number is selected randomly in that list, then at every new roll, the next random number is the next one in the list.
The issue is that there are no 4 consecutive numbers that are 0-35, 0-71, 0-71, 0-153 respectively.
This means Tentacool Doll (and Pikachu Bed) can't be obtained.
The sequence to obtain a Very Rare decoration (0-35, 0-71, 0-71, 154-255) appears once (15,34,25,164).
In short, none of the Pokemon Stadium 2 exclusive decorations are actually obtainable.
Special thanks to Lincoln for providing the initial disassembly of Mystery Gift functions of Pokemon Stadium 2.
https://github.com/Lincoln-LM/stad2