So, I’m apart of a few baseball leagues on Roblox, and the way the ball hits the bat is entirely random. (we just play for fun, never cared for skill) Basically, the script makes the velocity of the ball random with math.random() and then your hit is based on whatever comes out (usually the numbers are between like 15, 130).
Anyways, there’s a few players in particular that seem to always do well, and they aren’t exploiting or anything. They’re just entirely hitting well every season we play, but based on chance, shouldn’t they have at least one or two bad seasons, even if they get lucky?
I’ve heard math.random() is more of an algorithm, but is there any reason that some players are continuously lucky and some are continuously unlucky?
I’ve heard from a few developers that it’s more of an algorithm, but it still doesn’t explain why some players continuously get lucky to a point where you’d expect them to at least have at least one streak of bad luck, but it doesn’t happen.
Math.random isn’t entirely random, it’s pseudo - random, even if it looks like it’s random, you can change the seed that math.random uses by doing math.randomseed(seed) and then call math.random again; it’ll be based off of the seed.
Something a lot of people do is use math.randomseed(tick()) since it’s constantly updating & never the same number, if you’re concerned about randomness consider updating the seed after each hit, I can’t guarantee this’ll work but it seems to make sense in my head.
Don’t call randomseed before every call to random. It’s supposed to be called once at the start of a sequence of random numbers - for example at the start of the game. Or just use the new Random type, it automatically picks a randomized seed so you don’t have to even think about it.
@peterr how “good hits” would you say these lucky players have gotten in a row? If the hits are truly random then there’s nothing preventing long streaks of luck, a longer streak is just less likely.