Inaccuracy of math.random

so I got this code or as Formula here below

It was supposed to be from -15 to 15 from the Y Axis of Rotation
but instead it gave me more then -15 or 15

here is some code I did

-- Paths
local Part = script.Parent

-- Services
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1.5,Enum.EasingStyle.Quad, Enum.EasingDirection.Out)

-- Config
local SPIN_DEBOUNCE = false
local SPIN_DELAY_FOR_DEBOUNCE = 1

-- functions
local function Yield(s)
	local t = tick()
	while tick()-t < s do RunService.Stepped:wait() end
	return tick()-t
end

local function TweenPart()
	local NewTween = TweenService:Create(Part, tweenInfo, {
		CFrame = Part.CFrame * CFrame.Angles(0,math.random(-15,15),0)
	})
	
	NewTween:Play()
	NewTween.Completed:Wait()
end

-- spinning
while true do
	TweenPart()
	Yield(SPIN_DELAY_FOR_DEBOUNCE)
end

CFrame.Angles() takes angles in radians, not degrees so you have to turn the result from math.random() to radians with math.rad() like this:
CFrame.Angles(0,math.rad(math.random(-15,15)),0)

and some reason it still increases from 15 and -15

Then you have to change CFrame = Part.CFrame * CFrame.Angles(0,math.random(-15,15),0) to CFrame = Part.CFrame:ToWorldSpace(CFrame.Angles(0,math.rad(math.random(-15,15)),0))

Hello!

If you dont trust the math.random you can use Random!

Its a pretty simple API:

local ran = Random.new(some seed or just use tick())
-- We need the random object to find the random numbers

local SomeInteger = ran:NextInteger(-1,1)
-- This returns a number between -1 and 1. This could be 0 or 1

local SomeDecimal = ran:NextNumber(-1,1)
-- This returns a decimal point from -1 to 1. This could be 0.5 or -0.9

By the way you dont need to give the Random.new a seed!

I mean I’d suggest using Random.new():NextNumber(min,max), however you might want to check this out as well.