Rolling pre-release from dev (published by GitLab CI). Moves to every new dev commit.
⚠️ Preview build: may contain unstable or breaking changes. Use a v* release for production.
| Item | Value |
|---|---|
| Commit | c302ca3 feat(coin): Add Coin Flip tool
|
| Based on | v1.5.0 + unreleased changes |
| Docker | docker pull darknetz/php-rand:dev / docker pull ghcr.io/darknetzz/php-rand:dev
|
| Changelog | CHANGELOG.md |
Major Features
- Rolling
dev-latestrelease – Every push ofdevto GitLab now publishes a Dev Latest pre-release on GitHub and GitLab, like jotty-android. A newdev-latestjob in.gitlab-ci.ymlrunsscripts/publish-dev-latest.sh, which moves thedev-latesttag to the commit on both remotes and recreates the GitHub pre-release (never marked latest). It also creates or updates the GitLab release through the job token. Notes link the commit and the:devDocker image and include the[Unreleased]changelog section. The job waits for GitHubdevto catch up and skips if a newer commit has replaced it.--dry-runpreviews the notes. Documented inREADME.mdandAGENTS.md. - Coin Flip – New Generators → Coin Flip tool (
modules/coin_flip.php): flip 1–100 coins (COIN_MAX_COUNTinincludes/config.php). Handlerhandle_coin_flipflips server-side withrandom_intand reuses the Dice Roller's 3D d2 coin, drawn in gold with H/T faces, then shows a copyable summary such as3 coins: Heads, Tails, Heads (2 heads, 1 tail). Shareddice_tray_html()builds the markup for both tools;renderDiceRoll()(js/rand.js) takes optional face labels (data-dice-labels) and the dice colour is now a--dice-hueCSS variable (style.css). - Dice Roller – New Generators → Dice Roller tool (
modules/dice_roller.php): choose the number of dice (1–100) and sides per die (2–1000, default 6). Handlerhandle_dice_rollrolls server-side withrandom_int;renderDiceRoll()(js/rand.js) tumbles a 3D CSS die per roll that has as many faces as the die has sides: a coin for d2, the real polyhedra for d4/d6/d8/d12/d20 (pips on d6), a d10-style trapezohedron for other even counts, a prism (barrel die) for odd counts, and a shaded ball above 60 sides (DICE_SHAPE_MAX_FACES). Faces are numbered 1–N with opposite faces summing to N+1 where the shape allows, 6/9-style numbers are underlined, faces are shaded from a fixed light, and the rolled face lands toward the viewer. When the rolled face is too small to read (many-sided dice), a result badge fades in over the die once it lands (DICE_BADGE_MIN_FONT). It then reveals a copyable summary such as3d6: 4, 1, 6 = 11. Respectsprefers-reduced-motion. Limits live inincludes/config.php. - Release script without a terminal –
scripts/release.shno longer aborts with__v: unbound variablewhen run without a controlling terminal (CI, agents): a newhas_tty()actually opens/dev/ttyinstead of checking[[ -r /dev/tty ]], which is true even with no terminal. The "Next steps" text no longer claims GitHub Actions creates the GitHub Release (Actions are unused); it prints thegh release createcommand instead. - Hexadecimal strings – String Generator gained Hexadecimal (lowercase)
0-9a-fand Hexadecimal (uppercase)0-9A-Fcharset toggles (flagsx/Xinstringgen_charset_chars(),includes/functions.php; accepted byhandle_stringgen). Turning one on clears the other built-in sets and the opposite hex case, so the output is pure hex (custom characters stay if enabled) (modules/gen_string.php). - String Generator character rules – New Character Rules card in the String Generator (
modules/gen_string.php): Avoid ambiguous characters drops look-alikes0 O o 1 l I |(STRINGGEN_AMBIGUOUS_CHARS), and Max per type caps how many Numbers / Lowercase / Uppercase / Special characters a string may contain (empty = no limit; e.g. Special = 1). Generation moved into a sharedstringgen_generate()used bygenStr()/genStrCrypto()(includes/functions.php): types drop out of the pool once they hit their cap, then the result is shuffled with the same RNG so capped characters don't cluster at the start.handle_stringgenrejects limits that can't fill the requested length, and the combinations count is marked as an upper bound when limits are set. - Multibyte charsets fixed – Symbols (
¤,´), Extended (ƒ†‡™•) and custom characters were split byte-by-byte withstr_split(), producing broken characters and an inflated pool size;stringgen_charset_chars()now splits with the sharedutf8_chars()helper. - Unbiased secure strings –
genStrCrypto()(includes/functions.php) now picks characters withrandom_int()instead oford(random_bytes(1)) % count, which favoured some characters whenever the pool size didn't divide 256 (e.g. the 62-char alphanumeric set). UI label and result banner now sayrandom_int(). - Secure random numbers by default – Number Generator now uses
random_int()(CSPRNG) unless a custom seed is set; a seed switches to seededmt_rand()(reproducible, not secure), so the two modes are mutually exclusive. New shared helpers inincludes/functions.php:rng_seed(),rng_is_seeded(),rng_int(),rng_pick(),rng_bytes(),rng_gmp_range()(rejection sampling overrandom_bytes()) andrng_source_notice().numGen()and the large-digit (GMP) path use them instead ofmt_rand()/array_rand()/gmp_random_range(), which also makes seeded large-digit output reproducible (gmp_random_range()ignoredmt_srand()). Number and String Generator output now states which RNG was used (.rng-noticeinstyle.css); the String Generator's non-secure mode is labelledarray_rand(). Unweighted Spin the Wheel picks withrandom_int(). Removed the unused legacyspinWheel()helper. GitLab #6. - Enter-key form submit – Pressing Enter in a tool form now sends the submit button's
name/value(GitLab #5). Before, the handler only looked at$('.genBtn:focus'), which is empty when focus is in a text field. As a result, OpenSSL (tool=encrypt|decrypt) and Bin↔Hex (tool=bin2hex|hex2bin) answered "Invalid tool selected.", or reused the button clicked last. NewgetFormSubmitter()(js/rand.js) usesSubmitEvent.submitter, then a focused submit button in the form, then the form's first submit button. This also fixes clicks in Safari, which doesn't focus buttons. Removed the deadbutton[clicked=true]code.submitToolForm()now serializes after adding its hiddenaction/responsetypeinputs. - UTF-8 in string tools – Multibyte text (æ, ø, å, ™, …) no longer turns into broken bytes (GitLab #4). New shared helpers in
includes/functions.php:utf8_chars(),utf8_reverse(),utf8_shuffle()(Fisher–Yates withrandom_int),utf8_invert_case(),utf8_to_ascii()(intlAny-Latin; Latin-ASCII, iconv fallback) andutf8_levenshtein(). String Generator builds its character pool per character instead of per byte, so symbols (¤,´), the extended set (ƒ†‡™•) and custom characters give valid UTF-8 and a correct "possible combinations" count. String Tools (handle_stringtools): reverse, shuffle and inverted case work per character; slugify/kebab-case transliterate first (blåbær→blabaer); remove punctuation/symbols/extended symbols keep non-ASCII letters and remove letters removes them; invalid UTF-8 input is rejected with HTTP 422. Levenshtein counts characters, not bytes (a→åis 1, not 2), and the 255-byte cap is replaced byLEVENSHTEIN_MAX_CHARS(1,000 characters,includes/config.php).