@quenty/randomutils 6.9.1 → 6.9.2-canary.544.3f5a3e1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/package.json +4 -4
- package/src/Shared/RandomUtils.spec.lua +42 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [6.9.2-canary.544.3f5a3e1.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/randomutils@6.9.1...@quenty/randomutils@6.9.2-canary.544.3f5a3e1.0) (2025-04-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* Fix existing tests ([655787c](https://github.com/Quenty/NevermoreEngine/commit/655787ced1139136e12f81800e229aa076731561))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [6.9.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/randomutils@6.9.0...@quenty/randomutils@6.9.1) (2025-03-21)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/randomutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/randomutils",
|
|
3
|
-
"version": "6.9.
|
|
3
|
+
"version": "6.9.2-canary.544.3f5a3e1.0",
|
|
4
4
|
"description": "Quenty's RandomUtils, utility functions for Roblox",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@quenty/loader": "
|
|
33
|
-
"@quenty/table": "
|
|
32
|
+
"@quenty/loader": "10.8.0",
|
|
33
|
+
"@quenty/table": "3.7.1"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "3f5a3e1713068da6783bfc06634e3d793ccd4030"
|
|
36
36
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
2
|
+
|
|
3
|
+
local Jest = require("Jest")
|
|
4
|
+
local RandomUtils = require("RandomUtils")
|
|
5
|
+
|
|
6
|
+
local it = Jest.Globals.it
|
|
7
|
+
local expect = Jest.Globals.expect
|
|
8
|
+
|
|
9
|
+
it("returns one option from the list", function()
|
|
10
|
+
local options = { "apples", "oranges", "bananas" }
|
|
11
|
+
local choice = RandomUtils.choice(options)
|
|
12
|
+
|
|
13
|
+
expect(choice).never.toBeNil()
|
|
14
|
+
end)
|
|
15
|
+
|
|
16
|
+
it("returns a shuffled copy of the table", function()
|
|
17
|
+
local options = { "apples", "oranges", "bananas" }
|
|
18
|
+
local shuffled = RandomUtils.shuffledCopy(options)
|
|
19
|
+
|
|
20
|
+
expect(options).never.toBe(shuffled) -- make sure it's a copy
|
|
21
|
+
expect(shuffled).toHaveLength(#options)
|
|
22
|
+
end)
|
|
23
|
+
|
|
24
|
+
it("shuffles the table", function()
|
|
25
|
+
local options = { "apples", "oranges", "bananas" }
|
|
26
|
+
RandomUtils.shuffle(options)
|
|
27
|
+
|
|
28
|
+
expect(options).never.toBeNil()
|
|
29
|
+
end)
|
|
30
|
+
|
|
31
|
+
it("computes the gaussian random function", function()
|
|
32
|
+
local random = Random.new()
|
|
33
|
+
local computed = RandomUtils.gaussianRandom(random)
|
|
34
|
+
|
|
35
|
+
expect(computed).toEqual(expect.any("number"))
|
|
36
|
+
end)
|
|
37
|
+
|
|
38
|
+
it("returns a random unit Vector3", function()
|
|
39
|
+
local randomUnitVector = RandomUtils.randomUnitVector3(Random.new())
|
|
40
|
+
|
|
41
|
+
expect(randomUnitVector).toEqual(expect.any("Vector3"))
|
|
42
|
+
end)
|