github Darknetzz/php-rand dev-latest
Dev Latest

pre-release54 minutes ago

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-latest release – Every push of dev to GitLab now publishes a Dev Latest pre-release on GitHub and GitLab, like jotty-android. A new dev-latest job in .gitlab-ci.yml runs scripts/publish-dev-latest.sh, which moves the dev-latest tag 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 :dev Docker image and include the [Unreleased] changelog section. The job waits for GitHub dev to catch up and skips if a newer commit has replaced it. --dry-run previews the notes. Documented in README.md and AGENTS.md.
  • Coin Flip – New Generators → Coin Flip tool (modules/coin_flip.php): flip 1–100 coins (COIN_MAX_COUNT in includes/config.php). Handler handle_coin_flip flips server-side with random_int and reuses the Dice Roller's 3D d2 coin, drawn in gold with H/T faces, then shows a copyable summary such as 3 coins: Heads, Tails, Heads (2 heads, 1 tail). Shared dice_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-hue CSS 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). Handler handle_dice_roll rolls server-side with random_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 as 3d6: 4, 1, 6 = 11. Respects prefers-reduced-motion. Limits live in includes/config.php.
  • Release script without a terminal – scripts/release.sh no longer aborts with __v: unbound variable when run without a controlling terminal (CI, agents): a new has_tty() actually opens /dev/tty instead 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 the gh release create command instead.
  • Hexadecimal strings – String Generator gained Hexadecimal (lowercase) 0-9a-f and Hexadecimal (uppercase) 0-9A-F charset toggles (flags x / X in stringgen_charset_chars(), includes/functions.php; accepted by handle_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-alikes 0 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 shared stringgen_generate() used by genStr() / 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_stringgen rejects 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 with str_split(), producing broken characters and an inflated pool size; stringgen_charset_chars() now splits with the shared utf8_chars() helper.
  • Unbiased secure strings – genStrCrypto() (includes/functions.php) now picks characters with random_int() instead of ord(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 say random_int().
  • Secure random numbers by default – Number Generator now uses random_int() (CSPRNG) unless a custom seed is set; a seed switches to seeded mt_rand() (reproducible, not secure), so the two modes are mutually exclusive. New shared helpers in includes/functions.php: rng_seed(), rng_is_seeded(), rng_int(), rng_pick(), rng_bytes(), rng_gmp_range() (rejection sampling over random_bytes()) and rng_source_notice(). numGen() and the large-digit (GMP) path use them instead of mt_rand() / array_rand() / gmp_random_range(), which also makes seeded large-digit output reproducible (gmp_random_range() ignored mt_srand()). Number and String Generator output now states which RNG was used (.rng-notice in style.css); the String Generator's non-secure mode is labelled array_rand(). Unweighted Spin the Wheel picks with random_int(). Removed the unused legacy spinWheel() 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. New getFormSubmitter() (js/rand.js) uses SubmitEvent.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 dead button[clicked=true] code. submitToolForm() now serializes after adding its hidden action/responsetype inputs.
  • 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 with random_int), utf8_invert_case(), utf8_to_ascii() (intl Any-Latin; Latin-ASCII, iconv fallback) and utf8_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 by LEVENSHTEIN_MAX_CHARS (1,000 characters, includes/config.php).

Don't miss a new php-rand release

NewReleases is sending notifications on new releases.