Well first, you don’t need a table. You can do: local val = math.rand(1, 2) and get a value that’s either 1 or 2.
Now your issue of getting 1 1 1 1 2, you’re running into the nature of random numbers. Over a short run like that, and only two choices its perfectly normal to get the same number 4 times in a row (or more). You are in effect flipping a coin.
Over any short run, it’s possible to flip a coin 10 times and get 10 heads. This is because when you flip a coin there is a 50% chance to get a 1 and a 50% change to get a 2. You could go for some very long streaks of getting 1’s before you get a 2. The Law of averages says over a long run, it will average out. Say you flip the coin 10,000 times you should be very close to a 50/50 split. But over a run of 10 flips you can’t expect consistency.
Rob