Skip to content

Commit 1991f4b

Browse files
committed
1.2.0 Release Final
1 parent fb088c0 commit 1991f4b

7 files changed

Lines changed: 401 additions & 231 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
3030
- name: Build Docker image
3131
run: |
32-
docker build -t omp-easing-functions/build:ubuntu-18.04 docker/build_ubuntu-18.04/
32+
docker build -t Randomix/build:ubuntu-18.04 docker/build_ubuntu-18.04/
3333
3434
- name: Run build in Docker container
3535
env:
@@ -42,7 +42,7 @@ jobs:
4242
-v "${{ github.workspace }}/docker/build:/code/build" \
4343
-e CONFIG=${CONFIG} \
4444
-e BUILD_SERVER=${BUILD_SERVER} \
45-
omp-easing-functions/build:ubuntu-18.04
45+
Randomix/build:ubuntu-18.04
4646
4747
- name: Upload Linux .so artifacts
4848
uses: actions/upload-artifact@v4

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.19)
2-
project(omp-easing-functions LANGUAGES C CXX VERSION 0.0.1)
2+
project(PawnRandomix LANGUAGES C CXX VERSION 0.0.1)
33

44
set(CMAKE_CXX_STANDARD 17)
55

README.md

Lines changed: 54 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,74 @@
1-
# open.mp Easing-Functions Component
1+
# Pawn Randomix
22

3-
An open.mp server component that adds textdraw easing and animation functionality.
4-
It is essentially a component-based version of the original
5-
[pawn-easing-functions](https://github.com/alexchwoj/pawn-easing-functions.git) by [alexchwoj](https://github.com/alexchwoj), with improvements and optimized performance for large-scale animations.
6-
7-
---
3+
Enhanced random number generator and utility for open.mp servers (SA-MP support planned), providing a PRNG (PCG32) for game mechanics and a CSPRNG (ChaCha20) for cryptographic security.
84

95
## Installation
106

11-
1. Go to the **Releases** page and download the archive or binary matching your server platform (Windows `.dll`, Linux `.so`).
12-
2. Extract it and place the component file into your open.mp server `components/` directory.
13-
3. Copy `omp_easing.inc` into the include directory used by your Pawn compiler (e.g. `gamemodes/qawno/include/`).
14-
4. Add
15-
16-
```pawn
17-
#include <omp_easing>
18-
```
19-
20-
to any script where you want to use easing native functions, then recompile your scripts.
21-
22-
---
7+
1. Download component binary for your platform (Windows `.dll`, Linux `.so`)
8+
2. Place in server `components/` directory
9+
3. Copy `Randomix.inc` to Pawn include directory
10+
4. Add `#include <Randomix>` to your scripts
11+
5. Recompile
2312

2413
## Functions
2514

15+
### PRNG (Fast Game Mechanics)
2616
```pawn
27-
// Utility
28-
native Float:GetEasingValue(Float:t, easeType);
29-
native Float:Lerp(Float:start, Float:end, Float:t);
30-
native LerpColor(color1, color2, Float:t);
31-
32-
// Position
33-
native PlayerText_MoveTo(playerid, PlayerText:textdraw, Float:x, Float:y, duration, easeType, bool:silent = false);
34-
native PlayerText_MoveToX(playerid, PlayerText:textdraw, Float:x, duration, easeType, bool:silent = false);
35-
native PlayerText_MoveToY(playerid, PlayerText:textdraw, Float:y, duration, easeType, bool:silent = false);
36-
37-
// Size
38-
native PlayerText_MoveLetterSize(playerid, PlayerText:textdraw, Float:y, duration, easeType, bool:silent = false);
39-
native PlayerText_MoveTextSize(playerid, PlayerText:textdraw, Float:x, duration, easeType, bool:silent = false);
40-
native PlayerText_MoveSize(playerid, PlayerText:textdraw, Float:x, Float:y, duration, easeType, bool:silent = false);
41-
42-
// Color
43-
native PlayerText_InterpolateColor(playerid, PlayerText:textdraw, color, duration, easeType, bool:silent = false);
44-
native PlayerText_InterpolateBoxColor(playerid, PlayerText:textdraw, color, duration, easeType, bool:silent = false);
45-
native PlayerText_InterpolateBGColor(playerid, PlayerText:textdraw, color, duration, easeType, bool:silent = false);
46-
47-
// General
48-
native PlayerText_PlaceOnTop(playerid, PlayerText:textdraw);
49-
native PlayerText_StopAnimation(animator_id);
50-
native IsAnimationActive(animator_id);
51-
52-
// Debug and monitoring
53-
native GetActiveAnimationsCount();
54-
native GetAnimationStats(&totalCreated, &peakConcurrent, &totalCallbacks);
17+
PRandom(max) // 0 to max-1
18+
PRandRange(min, max) // Range integer
19+
PRandFloatRange(Float:min, Float:max) // Range float
20+
PRandBool(Float:probability) // Probability boolean
21+
PRandWeighted(weights[], count) // Weighted selection
22+
PRandShuffle(array[], count) // Fisher-Yates shuffle
23+
PRandGaussian(Float:mean, Float:stddev) // Normal distribution
24+
PRandDice(sides, count) // Dice roll (2d6, 1d20, etc.)
25+
SeedPRNG(seed) // Set PRNG seed
5526
```
5627

57-
---
58-
59-
## Callback
60-
28+
### CSPRNG (Cryptographic Security)
6129
```pawn
62-
OnAnimatorFinish(playerid, animatorid, textdrawid, types);
30+
CSPRandom(max) // Secure 0 to max-1
31+
CSPRandRange(min, max) // Secure range
32+
CSPRandFloatRange(Float:min, Float:max) // Secure float
33+
CSPRandBool(Float:probability) // Secure boolean
34+
CSPRandToken(length) // Hex token (1-8 digits)
35+
CSPRandBytes(dest[], length) // Cryptographic bytes
36+
CSPRandUUID(uuid[]) // UUID v4 string
37+
SeedCSPRNG(seed) // Set CSPRNG seed (testing only)
6338
```
6439

65-
---
66-
67-
## Easing Types
40+
## Usage
6841

69-
```
70-
EASE_IN_SINE
71-
EASE_OUT_SINE
72-
EASE_IN_OUT_SINE
73-
EASE_IN_QUAD
74-
EASE_OUT_QUAD
75-
EASE_IN_OUT_QUAD
76-
EASE_IN_CUBIC
77-
EASE_OUT_CUBIC
78-
EASE_IN_OUT_CUBIC
79-
EASE_IN_QUART
80-
EASE_OUT_QUART
81-
EASE_IN_OUT_QUART
82-
EASE_IN_QUINT
83-
EASE_OUT_QUINT
84-
EASE_IN_OUT_QUINT
85-
EASE_IN_EXPO
86-
EASE_OUT_EXPO
87-
EASE_IN_OUT_EXPO
88-
EASE_IN_CIRC
89-
EASE_OUT_CIRC
90-
EASE_IN_OUT_CIRC
91-
EASE_IN_BACK
92-
EASE_OUT_BACK
93-
EASE_IN_OUT_BACK
94-
EASE_IN_ELASTIC
95-
EASE_OUT_ELASTIC
96-
EASE_IN_OUT_ELASTIC
97-
EASE_IN_BOUNCE
98-
EASE_OUT_BOUNCE
99-
EASE_IN_OUT_BOUNCE
100-
EASE_NONE
42+
```pawn
43+
#include <pawn-randomix>
44+
45+
// Game mechanics (fast PRNG)
46+
new damage = PRandom(100);
47+
new position = PRandRange(10, 50);
48+
new lootIndex = PRandWeighted(lootWeights, 4);
49+
ShuffleArray(players);
50+
51+
// Security operations (CSPRNG)
52+
new token = CSPRandToken(8);
53+
new uuid[37];
54+
CSPRandUUID(uuid);
10155
```
10256

103-
---
57+
## Helper Macros
10458

105-
## Animation Enum
106-
```
107-
enum eAnimatorTypes
108-
{
109-
ANIMATOR_POSITION,
110-
ANIMATOR_LETTER_SIZE,
111-
ANIMATOR_TEXT_SIZE,
112-
ANIMATOR_FULL_SIZE,
113-
ANIMATOR_COLOR,
114-
ANIMATOR_BOX_COLOR,
115-
ANIMATOR_BACKGROUND_COLOR
116-
}
59+
```pawn
60+
RandomChance(25) // 25% chance
61+
CoinFlip() // 50/50 chance
62+
RollD20() // 1d20 dice roll
63+
RandomElement(array, size) // Random array element
64+
SecureRandomElement(array, size) // Secure random element
65+
ShuffleArray(array) // Shuffle entire array
11766
```
11867

119-
You can preview each easing type visually here: [https://easings.net/](https://easings.net/)
120-
121-
---
122-
12368
## Credits
124-
- [alexchwoj](https://github.com/alexchwoj) and all pawn-easing-functions contributors
125-
- [AmyrAhmady](https://github.com/AmyrAhmady) for the open.mp component SDK
126-
- [Fanorisky](https://github.com/Fanorisky) (me)
69+
- PCG Random by Melissa O'Neill
70+
- ChaCha20 by Daniel J. Bernstein
71+
- open.mp Component SDK by AmyrAhmady
72+
- Fanorisky (me)
73+
74+
GitHub: https://github.com/Fanorisky/pawn-randomix

0 commit comments

Comments
 (0)