79 Commits

Author SHA1 Message Date
Wrath
7062f89bcd core:math/rand small documentation fix 2025-12-22 16:10:51 -05:00
Andreas Stenmark
ad11d3bea0 Fix #5978: choice_bit_set respects bit_set domain 2025-11-30 21:46:26 +01:00
Yawning Angel
ea1f1e275d base/runtime: Add chacha8rand as the default RNG 2025-11-29 16:16:52 +09:00
Yawning Angel
f74f93154a math/rand: Add xoshiro256**
This is extracted from the previos PR as an improved non-cryptographic
PRNG option.
2025-11-29 10:45:53 +09:00
Yawning Angel
110d869cd7 math/rand: Add a copy of the existing PCG PRNG
The switch to the new RNG will be a breaking change as the outputted
sequence will change for a given seed.  This is intended for backward
compatibility purposes only.
2025-11-29 10:45:53 +09:00
Xotchkass
b8f8e6a8df changed panic to assert 2025-11-28 14:11:37 +02:00
Xotchkass
a234f25fa5 Add range-based random number generation functions 2025-11-28 13:40:30 +02:00
Xotchkass
0ed24953bb add uint32_max, uint64_max, uint128_max and uint_max procs to math/rand 2025-11-26 23:06:19 +02:00
NicknEma
7317704fd0 Fix docs on int*_max 2025-11-04 13:11:48 +01:00
Jeroen van Rijn
7a9ea3ee6d Further overhaul of package line comments. 2025-10-09 23:05:29 +02:00
Jeroen van Rijn
c4c2431997 Package lines for core:math and more. 2025-10-09 19:56:21 +02:00
Xotchkass
2d5652dbd4 remove private _random_u64 and move it's functionality into public uint64 2025-08-14 13:39:18 +03:00
Xotchkass
df849891c1 use runtime.random_generator_read_bytes in read procedure instead of filling it manually. 2025-08-14 13:35:25 +03:00
Jeroen van Rijn
8597966a9f Fix rand.int_max comment 2025-05-28 11:50:24 +02:00
Jeroen van Rijn
47f889569f Fix float64_range example 2025-04-21 18:37:57 +02:00
Jeroen van Rijn
f7c4c80ef3 Fix broken examples in documentation tester.
No more:
```
We could not find the procedure "pkg_foo_example :: proc()" needed to test the example created for "pkg.foo"
The following procedures were found:
   bar()
```
2025-04-05 16:36:26 +02:00
gingerBill
ef016d957b Add @(require_results) to random generator 2025-02-24 13:48:07 +00:00
Colter
d5d900e292 fix typo in float32_range doc string 2025-01-29 12:20:07 -05:00
Laytan Laats
5622fb583c math/rand: add @(require_results) to create 2025-01-18 22:52:13 +01:00
gingerBill
1cf7a56ba7 General clean up of code 2025-01-01 15:13:46 +00:00
Laytan
cb2768625a math/rand: choice_bit_set return not_empty -> ok 2024-10-28 20:07:38 +01:00
Laytan Laats
10c2f8dbeb math/rand: add choice_bit_set 2024-10-26 13:50:28 +02:00
Laytan Laats
bb4fc9979a math/rand: support non-contiguous enums in choice_enum 2024-10-25 20:41:57 +02:00
Jeroen van Rijn
f627a38b4f Update rand.reset() example. 2024-07-31 20:00:55 +02:00
gingerBill
0d881e1561 Improve rand.shuffle further by splitting into 64-bit and 32-bit parts 2024-07-16 18:36:31 +01:00
gingerBill
ba49950454 Improve rand.shuffle 2024-07-16 18:33:01 +01:00
gingerBill
1770e3a9a9 Fix typo 2024-07-11 17:19:12 +01:00
gingerBill
19753ed8a3 Add rand.Generator and other calls 2024-07-11 17:12:42 +01:00
gingerBill
59d87d1f05 Add gen := context.random_generator parameters to rand calls 2024-07-11 17:01:34 +01:00
gingerBill
3f9a58808c More style improvements 2024-06-29 19:07:34 +01:00
gingerBill
149ecafdef Remove the need for rand in core:math/big 2024-06-15 15:43:57 +01:00
gingerBill
7ec17ecf98 Update core:math/rand to use context.random_generator and remove rand.Rand 2024-06-15 15:33:24 +01:00
gingerBill
318d5e4a7e Add Reset mode 2024-06-15 15:17:23 +01:00
gingerBill
c2a01096c4 Remove unneeded reassignment of r 2024-06-15 14:49:09 +01:00
gingerBill
dc4ec8638c Add runtime.Random_Generator interface 2024-06-15 14:45:57 +01:00
gingerBill
3a9b86628a Add @(rodata) and @(static, rodata) where appropriate 2024-06-06 15:23:52 +01:00
Yawning Angel
e2fa9be7e2 core/math/rand: Use core:crypto for the system RNG
This removes some code duplication and expands support for the system
RNG to all targets that `core:crypto` supports.
2024-04-23 11:47:43 +09:00
Feoramund
3e449e93dd Implement Fisher-Yates shuffle 2024-04-15 17:07:05 -04:00
gingerBill
e201a2fabb Add rand.choice_enum 2024-02-10 15:13:09 +00:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
eb261f5b28 Merge branch 'master' into new-sys-unix 2023-10-31 12:16:25 +00:00
Damian Tarnawski
49da19e013 Replace Math.random with crypto.getRandomValues for _system_number 2023-10-27 12:06:35 +02:00
flysand7
4d65b1ab9c Implement new sys/unix package 2023-10-27 10:51:21 +11:00
Damian Tarnawski
166803a2a5 Rename rand to rand_f64 2023-10-27 00:18:41 +02:00
Damian Tarnawski
11a2b2a942 Add system_random and random_bytes for js target 2023-10-27 00:05:38 +02:00
Lucas Perlind
7cc5177078 Fixed up missing output for rand examples 2023-09-27 16:34:19 +10:00
Lucas Perlind
8b680254ee Better guarantee boundaries of floating point rand 2023-08-18 11:19:01 +10:00
Lucas Perlind
b31d8b1ad0 Update rand documentation about floats 2023-08-16 21:13:56 +10:00
gingerBill
67f48aca96 Fix _random_u64 2023-08-15 11:06:12 +01:00
gingerBill
d13bed9a0a Change algorithm to work on 64-bit integers rather than 32-bit integers internally 2023-08-15 10:53:59 +01:00