Commit Graph

121 Commits (master)

Author SHA1 Message Date
Subhomoy Haldar 3647fb4def
rand: move dist functions to top module and PRNG interface; minor cleanup (#14481) 2022-05-22 13:21:52 +03:00
Daniel Däschle d679146a80
fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
yuyi 8830af5c89
rand: minor cleanup in choose() (#14376) 2022-05-12 11:20:38 +03:00
Subhomoy Haldar 79f8a3c796
rand: update README.md (#14341)
* update README for rand module

* use concrete values

* make sure code works
2022-05-09 17:59:20 +03:00
Alexander Medvednikov fbb9e65c0f all: ~500 more byte=>u8 2022-04-15 18:25:45 +03:00
Alexander Medvednikov fb192d949b all: replace []byte with []u8 2022-04-15 15:35:35 +03:00
Alexander Medvednikov d4a0d6f73c all: byte => u8 2022-04-15 14:58:56 +03:00
Alexander Medvednikov 014c3c97f0 all: byte => u8 2022-04-15 14:45:52 +03:00
Delyan Angelov a0e7a46be4 rand: speed up MT19937RNG.u64 2022-04-10 13:07:35 +03:00
Delyan Angelov 6c25f5b291 rand: fix needless array allocation in MT19937RNG.u64() 2022-04-10 13:02:31 +03:00
Subhomoy Haldar 3f90809035
rand: add missing pub modifiers for .byte() and .u32() methods (#13992) 2022-04-10 11:43:46 +03:00
Subhomoy Haldar 022fae1e7f
rand: make mt19937 automatically seeded, add seed_len to wyrand (#13966) 2022-04-07 16:00:30 +03:00
Vincenzo Palazzo d7817863c6
checker: type inference over a generic type should compile (#13824) 2022-04-01 19:31:27 +03:00
Subhomoy Haldar f75ce9dd82
rand: move functions from rand.util to the main module (#13840) 2022-03-27 17:38:59 +03:00
Nick Treleaven 2e963e36ac
rand: add `pub fn shuffle<T>(mut a []T) {` function + tests (#13811) 2022-03-23 15:31:26 +02:00
Subhomoy Haldar 40504e8600
rand: further bridge gap b/w rand module and PRNG interface (#13719) 2022-03-12 09:41:12 +02:00
Alexander Medvednikov 36ec47cd20 all: replace "NB:" with "Note:" (docs/comments) 2022-03-06 20:01:22 +03:00
Subhomoy Haldar a0d9e6e1c2
rand: extend PRNG interface, add buffering support (#13608) 2022-02-28 13:17:54 +02:00
Subhomoy Haldar 114a341f5f
rand: simplify rand.PRNG, move to optional types for error handling (#13570) 2022-02-23 12:36:14 +02:00
Delyan Angelov 3c38abc56e
rand: fix rand.uuid_v4()'s clock_seq_hi_and_reserved field 2022-02-18 12:43:38 +02:00
Delyan Angelov 66f21cae55
rand: add `pub fn rand.read(mut buf []byte)` and `pub fn rand.bytes(needed int) ?[]byte{}` + tests 2022-02-06 10:54:34 +02:00
jeffmikels a60b381d5e
docs: adding skeleton README.md files for all vlib modules (#13034) 2022-01-05 18:06:08 +02:00
Alexander Medvednikov 59ed4be49a all: update copyright year 2022-01-04 12:21:12 +03:00
Delyan Angelov 045579fd8a
parser: use the `[has_globals]` module attribute, remove the parser `global_enabled_mods whitelist` (part 2) 2021-11-16 11:44:36 +02:00
playX 864d6eae6b
js: codegen & vlib fixes, replace the Game of Life CLI example (#12272) 2021-10-22 22:03:19 +03:00
playX d373eba79b
js: implement more functions for JS backend (#12167) 2021-10-13 09:40:14 +03:00
Alexander Ivanov 0386f2bbea
checker: add an interface check for mutability, fixes #1081, fixes #7038 (#11963) 2021-10-11 15:41:31 +03:00
playX 82f187e5e0
js: fix `rand` build, properly use key values on map, add `rand.string` (#12020) 2021-10-01 21:23:49 +03:00
Delyan Angelov afc3531945
ci: work around a failing g++ compilation (order of methods in an interface dispatching table matters for C++ compilers) 2021-09-23 14:08:50 +03:00
Delyan Angelov 8837712f2b
rand: fix leaks with -autofree 2021-09-23 12:24:03 +03:00
yuyi 108a01d65f
fmt: fix unnecessary line break in array init (fix #11448) (#11562) 2021-09-21 16:20:09 +03:00
Daniel Däschle b63ec8fbcf
checker: require `params` attribute to use struct as keyword arguments in function (#11135) 2021-09-14 00:05:30 +03:00
yuyi e5360e164a
fmt: remove unnecessary parentheses after `return` (fix #11423) (#11435) 2021-09-08 14:19:53 +03:00
playX 0121c8b4fd
v.gen.js: fix method calls and other codegen parts, rand module compiles (#11205) 2021-08-18 11:33:37 +03:00
playX 659f823c5c
js: initial work on porting rand module to JS backend (#11188) 2021-08-15 18:09:51 +03:00
Delyan Angelov efa8dcf4d2
time: turn Time.unix to i64, so it can represent times before 1970-01-01, fix time operators, add more tests (#11050) 2021-08-04 13:12:02 +03:00
Daniel Däschle ad3835b598
parser: deprecate short struct init (#10842) 2021-07-20 11:17:08 +03:00
Uwe Krüger 60c880a0cc
vlib: use `malloc_noscan()` where possible (#10465) 2021-06-15 14:47:11 +03:00
Lucas Rodrigues fdc03f70b5
rand.util: workaround for inaccurate `v` warning in vlib/rand/util/util.v (#10344) 2021-06-04 17:05:58 +03:00
Uwe Krüger bd467f94ab
encoding: append `0` to strings for compatibility (#10249) 2021-05-29 16:31:52 +03:00
Delyan Angelov 8a380f4699
tools: make `v test-cleancode` test everything by default (#10050) 2021-05-08 13:32:29 +03:00
Uwe Krüger d26ac5692e
all: various fixes for [heap]/auto-heap handling (#10033) 2021-05-07 15:58:48 +03:00
Delyan Angelov 2eafea6308
v: reduce the memory usage of the compiler (analysed with heaptrack) 2021-05-06 11:44:48 +03:00
div72 dd00c79861
rand: fix wrong function signature (#9808) 2021-04-21 12:20:55 +03:00
Delyan Angelov 3e297bced4
ci: remove some tests from skip_with_werror in `v test-self` 2021-04-14 12:47:24 +03:00
Subhomoy Haldar c5bc349edb
rand: update documentation (#9406) 2021-03-21 19:36:17 +02:00
Subhomoy Haldar 0e80e57aa5
rand.dist: add exponential distribution function and unit tests (#9402) 2021-03-21 13:04:43 +02:00
Subhomoy Haldar 08da33fa5a
rand: add non uniform distributions in the `rand.dist` module (#9274) 2021-03-12 21:24:43 +02:00
yuyi a547e889af
checker: check array literal modify error (#9243) 2021-03-11 14:57:04 +02:00
Subhomoy Haldar a5dd7faf3c
rand: add PRNG interface and unit-tests (#9083) 2021-03-03 13:41:00 +02:00