Commit Graph

68 Commits

Author SHA1 Message Date
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
gingerBill
904c48b11a Fix range comment from (0, n] to [0, n) 2023-08-15 10:36:00 +01:00
Lucas Perlind
ebe5636307 Document core:math/rand and add 'possible output'
Possible output allows us to just type check a test
and have some sort of output field in the docs but
not actually verify it matches stdout
2023-05-31 09:49:12 +10:00
gingerBill
2df6cabee0 Add @(require_results) to core:math/rand 2023-05-22 11:59:44 +01:00
Jeroen van Rijn
a51943e27f Add core:math/rand.choice 2022-10-23 04:18:58 +02:00
gingerBill
4eba2bb8d9 Add _system_random for Darwin 2022-05-15 23:46:32 +01:00
gingerBill
2a58bceb56 Add rand.init_as_system to allow for system-level based random number generation 2022-05-15 23:43:20 +01:00
gingerBill
fdcf08410c Add Gompertz Distribution 2022-05-15 23:03:01 +01:00
gingerBill
5142955f00 Add more distributions 2022-05-15 22:58:39 +01:00
gingerBill
500150b12a Correct log normal 2022-05-15 22:52:11 +01:00
gingerBill
50ddd8dd26 Fix typo 2022-05-15 22:45:05 +01:00
gingerBill
6c6de2a07d Move distributions to a separate file 2022-05-15 22:20:25 +01:00