The generation of random numbers has many uses (mostly in statistics, for random sampling, and simulation). Before modern computing, researchers requiring random numbers would either generate them through various means (dice, cards, roulette wheels, etc.) or use existing random number tables.
Yawning, swallowing or chewing helps open the small canal (Eustachian tube) which connects your middle ear in the inner side of the ear drum, and equalizes the pressure with the outer side and causes the sensation of ears popping when swallowing.
It is possible that you have two different conditions. For example, it sounds like you have a long standing history of your jaw popping when you chew, which is definitely not a symptoms of an ear problem! At the same time, your doctor recently diagnosed you with a likely ear infection. This can be complicated, because an ear infection can cause pain that radiates down into the jaw area. Typically this pain will get better as the infection goes away. What I would suggest, therefore, is that you go back to see your primary care doctor to make sure the ear infection is getting better.