Running a casino and creating good games requires different sets of skills. Moreover, players like to play the same games over and over. Those are probably the reasons why specialized companies which focus solely on creating casino games were established.
This is briefly how it works:
1- Casino initiates your gaming session.
2- Your browser communicates with the servers of the game provider, not with the casino.
3- The random number and round outcome is also generated by an independent company (the game provider).
4- Casino just confirms your bets and is notified about your wins by the game provider.
There is one very important implication of this: if you are losing too much while playing a game from a reputable game provider, you can be quite sure that it’s just your bad luck. Even if you play your favorite game at an unknown casino, you are quite safe, in terms of game fairness.
How slots are programmed:
1- Player presses the spin button in a slots game in his browser.
2- Game sends a "spin" message to the server of the game provider.
3- Server of the game provider calculates the required bet. Server of the game provider asks the casino to deduct the amount of money required for the spin.
4- Server of the casino confirms.
5- Server of the game provider requests a random number from the random number generator (RNG).
6- RNG replies with a fair random number.
7- Server of the game provider uses the random number to spin virtual reels and calculates the outcome of the game round.
8- Server of the game provider asks the server of the casino to add winnings to the player’s account.
9- Server of the casino adds the win and confirms.
10- The outcome of the round is returned to the game which runs in the player’s browser.
11- The outcome of the round is animated and displayed to the player.
And all this usually happens within less than 200 milliseconds.