Breaking Changes
- RandRange(min, max) now returns values in range [min, max) (half-open) instead of [min, max]. This aligns with SA-MP's random() convention where RandRange(0, 10) and Random(10) both should return 0-9.
New Features
- Added RandPointInArc(cx, cy, radius, startAngle, endAngle, &x, &y) native for generating random points within circular sectors
- New convenience stocks:
- RandInt(min, max) - Alias for RandRange
- RandAngle() - Random angle [0, 2π) in radians
- RandSign() - Random +1 or -1
- RandColorAlpha(alpha) - RGBA color with custom alpha
- RandVecInRange(min, max, &Float:x, &Float:y, &Float:z) - Random 3D vector
- RandLoot(itemIds[], weights[], count) - Weighted loot table selection
- RandPointInCircleAroundPlayer(playerid, radius, &Float:x, &Float:y) - Spawn point around player
- Added dice macros RandD2() through RandD100() for tabletop gaming
- Added RandShuf(array[]) and RandShufRange(array[], start, end) shuffle macros
- Added RandElem(array[], size) for random array element access
- Added RandEither(opt1, opt2) to pick one of two options
- Added RandChance(percent) for percentage-based checks
- Mathematical constants: RANDIX_PI, RANDIX_TWO_PI, RANDIX_HALF_PI
- Angle conversion macros: Deg2Rad(deg) and Rad2Deg(rad)
- [[nodiscard]] attributes on ChaChaRNG methods
- Added .dockerignore for faster Docker builds
Changed
- Renamed stocks for consistency (unified Rand* prefix):
- RandomColor() → RandColor()
- RandomColorAlpha() → RandColorAlpha()
- RandomSign() → RandSign()
- RandExcept() → RandExc()
- RandExceptMany() → RandExcMany()
- RandHexString() → RandHex()
- RandString() → RandStr()
- ShuffleArray() → RandShuf()
- ShuffleArrayRange() → RandShufRange()
- RandomElement() → RandElem()
- RandomPick() → RandEither()
- RandomChance() → RandChance()
- RollD*() → RandD*()
- DegToRad() → Deg2Rad()
- RadToDeg() → Rad2Deg()
- Simplified code comments (removed // === block separators)
- Updated plugin load/unload messages with version info
- CI/CD now builds both open.mp and SA-MP variants
Improvements
- Major code deduplication with randomix_impl.hpp
- RandPointInPolygon() now uses stack buffer instead of heap allocation
- Added comprehensive bounds checking (NaN/Inf detection, overflow protection, sanity limits on array sizes and iterations)
- Project restructured: all sources moved to /src/ directory
- Build system simplified and Docker updated to Ubuntu 22.04 with Clang 14
Fixed
- RandPointInPolygon: Replaced heap allocation (std::vector) with stack buffer
- RandLoot: Fixed sizeof reliability issue
- Added integer overflow protection in weighted functions
- Redundant null check removed in onFree() handler
- Fixed typo in documentation
- Fixed CMake compatibility with -DCMAKE_POLICY_VERSION_MINIMUM=3.5
- Removed unused minSize parameter from CheckArrayBounds()
Full Changelog: v2.0...v2.0.1