From patchwork Sun Nov 22 12:20:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Roberto A. Foglietta" X-Patchwork-Id: 5633 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Sun, 22 Nov 2026 13:20:49 +0100 X-Sieve: CMU Sieve 2.4 Received: from mail-dl1-f58.google.com (mail-dl1-f58.google.com [74.125.82.58]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 6AMCKmC6001243 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sun, 22 Nov 2026 13:20:49 +0100 Received: by mail-dl1-f58.google.com with SMTP id a92af1059eb24-1b56c696405sf2146392c88.1 for ; Sun, 22 Nov 2026 04:20:48 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1795350042; cv=pass; d=google.com; s=arc-20260327; b=hkXdn51mOnFH0MOOorbZLeapdqcU96mzQKPJC5mLZLvI6Ix8s5k19mcDtF1IXpM8SE p2aeW5XTj7pPxMdcYQZwmcWOQ8bBw21a6P0mH2EFE4ufTWsda2zAN16De4PpGpk9XWXX 5HewYAjBMlSLENR+xY+1opUn5yymAmY0xFenFRaoumJWSEBSWeoKoIaul/bPxlTU63+S t5mx3nk+CtPcbPzXVlqgLhR8hPWymeZT5ZfVZBkLrL1OQ7nKAdmLznR+mOf5tnEulBCi 90Lw52x22q61NlMzHBF4ELfRZ/S1zjpOPElJdpOYpzplIYA7rOO6jXuiY8KtSDmFj7/W RCuQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:to:subject:message-id:date:from :mime-version:sender:dkim-signature:dkim-signature; bh=TS7sxO7MtzYtk5/zp0kKh2Q54tVKeyuOonMIDLtq1Ao=; fh=07yudv/7Y/NSgO1PJZswQ15aeQrvWcvAWuQgkWXh9L0=; b=nQS1cP9KaIlg+YRc4xM9U29GNfkVjBKhTzXvPrlY82L3FlJ8RzNuvaAhfNizExX1dd 2Y0FqnYnzKEMygEhq6oaT71MO+QExmFngWJjPUGl0dKP0VzFdzPViBDO37SZT/2bB39o 7vINcD+TfizdR3xfCkSdf8iWHc/hV/9Kn+ShVehXC97+4ULHA5DL889CoXYCAT3hpvXQ MzBXWNV50Pb1OD/qRc9wlsTKRdgPBwzBCbqIrq2ULXss8iFz1ET1snKBJfSe0GYhEX96 SAoZni00rBMOLMDFyN7qaOolKKBkFOrj1krw3z3pd0zbdWK4KfjPXKzgNT50PEl+grQx 62rQ==; darn=isar-build.org ARC-Authentication-Results: i=3; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20260707 header.b=xPx5qjFh; arc=pass (i=1); spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20260707; t=1795350042; x=1795954842; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-type:to:subject:message-id:date:from :mime-version:sender:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TS7sxO7MtzYtk5/zp0kKh2Q54tVKeyuOonMIDLtq1Ao=; b=LTm9/gwLzicufUT+vYegpDW/jR8JhYHu7obRvnJ5tPaR7OJvyJ6PuStldLbKG3kq1b q9Ih88qBrn7bukT4Td49ghv8R9jK9EL6Jp0PCvPrDnztILbxpGL7NZFJQT/upXtXr9Mb e65d76F14ScKD4wSHFp5seruEgtfIaGZSqwcAmrHJqDlj7sM2EbZtfE34je8hEK4pcdO YTVw3ICCj6p2jLW1/M2V8di4CFQaB1JyXhOFCu2Gia3Zh3daafZ5RywhhFp4oXBKvaTa ZSrKpUylUbUnsfEV8VD3Vzt5SYeZ3PeDFC8URTzwdbbl7HPJdBdSHjXdvgZULRluLM66 jGCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795350042; x=1795954842; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-type:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to :content-type; bh=TS7sxO7MtzYtk5/zp0kKh2Q54tVKeyuOonMIDLtq1Ao=; b=oMMnTZ/Y/74B6ecCISVv4ObIVuhXv9EaNBdWOMT084b10sea3qYCreu2335I1GnZpK ucVrcQ84m3RRf+SjnmZSjP93YwhcXo/pq2+HTTLADXGX6r/c9QleLL4lQ5JQziLc2JNv 648FdN4UGQ2njhMdCLrZwRcIIaHdURyF3zuYbs/ZO3IWxVPNH8dO88blmhqfU4v8DhQF LtOS7aOidce2I/OhuiZYr+qGDW/Peks+1RaHWWSj7g9lqaByj66ZRSJA+siyeJWRc1P2 +dAuqPedosyVDx8dONP/1QAua/xOjs6Yo/AkGya3BXfyLOjxMb+Yu8j6JYewrIh2usca y6mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795350042; x=1795954842; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:content-type:to :subject:message-id:date:from:mime-version:x-gm-gg:x-beenthere :x-gm-message-state:sender:from:to:cc:subject:date:message-id :reply-to:content-type; bh=TS7sxO7MtzYtk5/zp0kKh2Q54tVKeyuOonMIDLtq1Ao=; b=UjY1tuUM3NYX+gZ0JpzC8ZtaeM6+UvYMR0ouRGM8DoWdwVqsm2rQv5Ihk/y9NpJz3f vM+Ni743SflJp7g42AYmubqvQRZNBakWXONRlJxOMU17bwUjCUFC7fn74lCipq1FoXPn zeI7XnI6KQMBNWD+ZmcSEzo4SlsZrNMXYQymmEFPvx135QbBWEppP3BLRWfuGlRaWS7+ 7Dzf8dOzjpel9kziB5M8+Z87d+x3j70fiRrpWpzAtqy+ZctO7WHEv0cw7F7LPgay1IPo TqwHBef6kL1Iy0JXszYwLU2xE6K5mIu3BJaUr8CyP+wR/F1s+M7QsBMo0k5NggOxM7TF diAw== Sender: isar-users@googlegroups.com X-Forwarded-Encrypted: i=3; AL+hErEDpuePpMQWetoQnBba5CJO+CkN5rEzsS1UIQr7zcxz33WiJpp7G0Mz6ZWjt+un3zniYPc//7Q=@isar-build.org X-Gm-Message-State: APuU4Z9MKxo/eN3Mm8xpM+5kKn6KQcXhzTO8eJbIDftbnOnT/XkvlywN H0ubtUx2cMWlZwZtZoWiSM9NRFepkBWp5D/1gFWpV5XtmKUmYnfcbpd+ X-Received: by 2002:a05:7022:ea21:b0:1b3:b6d3:b91c with SMTP id a92af1059eb24-1b5568b3149mr10066494c88.7.1795350042043; Sun, 22 Nov 2026 04:20:42 -0800 (PST) X-BeenThere: isar-users@googlegroups.com; h="ATskLdcmIYwT4SiKBohIU2tXTAaQiDufoekKHHjW9GVifeHLPQ==" Received: by 2002:a05:701a:8459:10b0:141:75f1:49bb with SMTP id a92af1059eb24-1b5577d3a9bls1935829c88.2.-pod-prod-01-us; Sun, 22 Nov 2026 04:20:40 -0800 (PST) X-Received: by 2002:a05:7300:f0c2:b0:386:688:7f25 with SMTP id 5a478bee46e88-386068880f5mr7631000eec.18.1795350039976; Sun, 22 Nov 2026 04:20:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1795350039; cv=pass; d=google.com; s=arc-20260327; b=EcchMSLz/XjDC2qyrtzJq2mv8ptHCcfD1gM4O+SwFme/DLLZ8K7bmyB2LSTV1pAHkk 4iX9HM1bGMUMiMl+UkIx/tUOffkD6wslVDs3/eGEpC0osF5+BVDbC2wvxry5YlxZa/VO ylWMaKuXXYMwNRPQhpJVYu/7GSBG6zii9pCoIk4pOFV4porooFsXu39deivf8PpJRwk7 w+/dhMdj8Ff1oii63qzFsXs4pJHLuBu9NdVipLEoLKkGrUHWFFE452+8+CRgw+K+kT17 Mik4kfpADoMmQsXjwP/sGBBYkm3Z1yCZYjFc1R6maUAX6YFyDxkqqV2Jg47ee3B79Kxh yo9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=2T/y50ewpAJvOfYAGN6z4ajFfmzJgo4Bvtya1UhrusM=; fh=hOBXq6nisExkIRIwN8IDOmOCLKwX8PM0ANlxQbNMEqA=; b=dgnWA+Cgsuh0Mps9NWeiOZ2/VcXiW+GiI/hggUtBJ3MXUXMFt5/3+/XuqbJcaTjauR ng9tRuDOj8OGeU4JdBMOkGREmUNqZ1/nDTONknMwcu0SWD/FhnQbOubPggGsiAit5yLz FlK8KybAoXdgADYKR5/KXmYTOoxW5X+UR8L9VD8kCCpg4pvKf0Eg/Py6dkap/GXW6PEB 4AbsuAfx3ZTbZ0/nUSczWrZoFVkyotRcfRel8lBekdONUHIj0FaQK+Bkf1wuT8d0eY4i RQ6ub3K3g7JWWh2TKTEd+S0WMGwKsip7bg7vou2UUENhwas9TB8WtVdzDqNQgkjFAxd9 cA+g==; dara=google.com ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20260707 header.b=xPx5qjFh; arc=pass (i=1); spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com. [2607:f8b0:4864:20::1129]) by gmr-mx.google.com with ESMTPS id 5a478bee46e88-38567ab6ff0si178791eec.8.2026.11.22.04.20.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 22 Nov 2026 04:20:39 -0800 (PST) Received-SPF: pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::1129 as permitted sender) client-ip=2607:f8b0:4864:20::1129; Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-8b4d26094beso20001657b3.1 for ; Sun, 22 Nov 2026 04:20:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1795350039; cv=none; d=google.com; s=arc-20260327; b=SuhlgrnlUlTDv8P5AdYL5TJB7vliWTaSraKuC4lZltzoBWvu1NpdvNG68oIZ6PzZk2 fCr7j8JWjVVuZGGzoxYqLTkHvJb4T8Q2CamceJZhWjGXy+UAZKgPdryNa/nLpbJqmV1e Ik+Uz28lkyjxRSii/Ne9QTn4MqxpwMNPxDmPsjJP/xI4U/d/7h3Ton6oZG21XZwyG/Yd kWbdD7K/iO2jf7o/kK5uAM8Ixt6wyumGyB/tLc/S9uwZTBn+ZUWk7g0FcMS/IqmXcdph 2Fm8BRaS6Ra+6ds7AkmCEFslSeLDM9SHVB4Vgx8jxz6LKCqwDg+A3ITOB/e1q1VkPGtl 8LqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=to:subject:message-id:date:from:mime-version:dkim-signature; bh=2T/y50ewpAJvOfYAGN6z4ajFfmzJgo4Bvtya1UhrusM=; fh=hOBXq6nisExkIRIwN8IDOmOCLKwX8PM0ANlxQbNMEqA=; b=NZ7k+i1alf8cxkrV3QEQ3NsLLeKzxUbENk9BeKazehlwgqzXj1BM+/nX3eYb/3Jzpw kAmXj0DKK1FgiK4N9spQznWYg1ljJOaGW628uj/BVUSwFAEZsc2mj1xUv12He2qcZ3ZB 0c7dkjVClxSFTPvhgTyKrRiYcpPsPTbZK7TWiwxkhJ1zBeVMjYLsUUMuc9sBqgJNZUjq BOIfH45SvH2dFtrrXplrDNHmcs40SgBh9epDlp9NR4+pvWwag9nHPlzH+LSq/iXgpOqE nWJ1CYOVFMxr1Ob8NV1EnXOsk3gFw430NKpiiMcMY5JMSD2sq08+Z53TXOssckvoRX0E ob4Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; arc=none X-Gm-Gg: AZFdTZeHE3iQ1hY6gdAN+gaalp7FX7iIgJPxjxLQcLrhd6fUzd7vpw3LF+6zHjPiQ9R dpiHKe7gOnnCxxe+Cce5o2HIgfuEJrvv0MHj2kHIJVaAX+ggW2k3YL6gogmLZE3AGE4Ze46sbtQ 7rtoRWgsl2iZ1oix0+44qEmdYLc7AseehRfPJ0R56Quc3uVBIVZUQT4XCCE/zY7SBBzQwJRsDu+ l3hMKRw20vA6Tp56l3y2IlQlMDj2RrMNHtNdjf00cxtiqQvcxmhzovIhCNgoxdPdiGKbKBUXq5I LlwFNL93wGZRxFsh0Y5lL8hJhtghkCvJ0f1uEuNEgINhpklzt7WP1m8DS5clmsFjVZxdY2r2Lds ftaOKFVs7GAxJCfaIkC8THIP05mkYZ5cktwPudR7SgQMNe6D74ZRpXqG3XSiM3ML+nG+q8wcmPV GLwaKt++QHr003ZmXm8limbpD1ObXHIETaAJANAy30LlUBrzZfgIUKAl2hJ6IuF96bPvZLbs+Oy jxjVS23DPuVBNeZScYRPu4XU0i1V0nxWl38hQMUig54ocNb1QmeCRWwbSpOYYkwU8XpeVHpuyGA KgsyU+sAiLAjVBrUGevuoto3NeE= X-Received: by 2002:a05:690c:3084:b0:8b3:3854:c294 with SMTP id 00721157ae682-8b5204e44d8mr34958317b3.46.1795350039059; Sun, 22 Nov 2026 04:20:39 -0800 (PST) MIME-Version: 1.0 From: "Roberto A. Foglietta" Date: Sun, 22 Nov 2026 13:20:01 +0100 X-Gm-Features: Aa3M54rIzjPNeUvbSwV59NAR3XkLdZORVaK3EcG1GCClrrG_PY4NZhcb80uwGc8 Message-ID: Subject: BusyBox random.c needs a fix To: isar-users X-Original-Sender: roberto.foglietta@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20260707 header.b=xPx5qjFh; arc=pass (i=1); spf=pass (google.com: domain of roberto.foglietta@gmail.com designates 2607:f8b0:4864:20::1129 as permitted sender) smtp.mailfrom=roberto.foglietta@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-3.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_GMAIL_RCVD, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= Hi, for your information, BusyBox random.c needs a fix. In attachment the fix. $ gcc -O2 -g0 shell/random.c -Ishell/ -DRANDTEST -o ./bboxrnd random.c: In function ‘main’: random.c:154:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 154 | write(1, buf, sizeof(buf)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ $ ./bboxrnd | ~/robang74/uchaosys/prnd/RNG_test stdin32 RNG_test using PractRand version 0.96 RNG = RNG_stdin32, seed = unknown test set = core, folding = standard (32 bit) rng=RNG_stdin32, seed=unknown length= 256 megabytes (2^28 bytes), time= 2.7 seconds Test Name Raw Processed Evaluation [Low8/32]BRank(12):score:1280(15) R=+673.0 p~= 1 FAIL !!!!!!!! [Low1/32]BRank(12):score:512(12) R= +8182 p~= 1 FAIL !!!!!!!! ...and 154 test result(s) without anomalies Best regards, From 8a48b8e8801fc682344ee8ac373121405ca03a9e Mon Sep 17 00:00:00 2001 From: "Roberto A. Foglietta" Date: Sun, 22 Nov 2026 12:32:14 +0100 Subject: [PATCH] shell/random.c: current PRNG requires a whitening hash, fixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RATIONALE dieharder is a weak testing tool compared with PractRand but at that time (2009, October) -- even if it was available in its first version (2009, April) -- it was almost unknown. Until 2010 when academic literature commonly started to cite PractRand. Moreover, a period of 3E38 seems great but there is still a problem (also at full 32-bit, but $RANDOM uses the last 15-bit) which is about hyperplane correlation. In worst cases a single process alredy fails. When it doesn't, it can be tested with mixing parallel runnings, like gnu parallel x8 bb-rand (mixer) | PractRand RNG_test stdin32. Busybox's random requires a stage of whitening otherwise fails to be a minimum acceptable PRNG as this quick test below shows: $ gcc -O2 -g0 shell/random.c -Ishell/ -DRANDTEST -o ./bboxrnd random.c: In function ‘main’: random.c:154:17: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 154 | write(1, buf, sizeof(buf)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ $ ./bboxrnd | ~/robang74/uchaosys/prnd/RNG_test stdin32 RNG_test using PractRand version 0.96 RNG = RNG_stdin32, seed = unknown test set = core, folding = standard (32 bit) rng=RNG_stdin32, seed=unknown length= 256 megabytes (2^28 bytes), time= 2.7 seconds Test Name Raw Processed Evaluation [Low8/32]BRank(12):score:1280(15) R=+673.0 p~= 1 FAIL !!!!!!!! [Low1/32]BRank(12):score:512(12) R= +8182 p~= 1 FAIL !!!!!!!! ...and 154 test result(s) without anomalies Conversely, with the murmux3() implementation from from uChaoSys, it can pass gigabytes of PractRand test (tested up to 16GB, w/ unsual). ./bboxrnd | ~/robang74/uchaosys/prnd/RNG_test stdin32 About speed, running 8 threads on a Intel i5-8365, it runs at 1.4GB/s, circa ( for i in $(seq 1 8); do ./bboxrnd & done; wait; ) | dd bs=1M of=/dev/null Signed-off-by: Roberto A. Foglietta --- shell/random.c | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/shell/random.c b/shell/random.c index 56c7c5a3c..7362cdc9c 100644 --- a/shell/random.c +++ b/shell/random.c @@ -3,6 +3,7 @@ * $RANDOM support. * * Copyright (C) 2009 Denys Vlasenko + * Copyright (C) 2026 Roberto A. Foglietta * * Licensed under GPLv2, see file LICENSE in this source tree. */ @@ -13,6 +14,60 @@ * ./random | dieharder -g 200 -a */ +/* RAF ///////////////////////////////////////////////////////////////////////// + * + * RATIONALE + * + * dieharder is a weak testing tool compared with PractRand but at that + * time (2009, October) -- even if it was available in its first version + * (2009, April) -- it was almost unknown. Until 2010 when academic + * literature commonly started to cite PractRand. + * + * Moreover, a period of 3E38 seems great but there is still a problem + * (also at full 32-bit, but $RANDOM uses the last 15-bit) which is about + * hyperplane correlation. In worst cases a single process alredy fails. + * When it doesn't, it can be tested with mixing parallel runnings, + * like gnu parallel x8 bb-rand (mixer) | PractRand RNG_test stdin32. + * + * Busybox's random requires a stage of whitening otherwise fails to + * be a minimum acceptable PRNG as this quick test below shows: + * + ******************************************************************************* + +$ gcc -O2 -g0 shell/random.c -Ishell/ -DRANDTEST -o ./bboxrnd + +random.c: In function ‘main’: +random.c:154:17: warning: ignoring return value of ‘write’ declared +with attribute ‘warn_unused_result’ [-Wunused-result] + 154 | write(1, buf, sizeof(buf)); + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + +$ ./bboxrnd | ~/robang74/uchaosys/prnd/RNG_test stdin32 + +RNG_test using PractRand version 0.96 +RNG = RNG_stdin32, seed = unknown +test set = core, folding = standard (32 bit) + + rng=RNG_stdin32, seed=unknown +length= 256 megabytes (2^28 bytes), time= 2.7 seconds + Test Name Raw Processed Evaluation + [Low8/32]BRank(12):score:1280(15) R=+673.0 p~= 1 FAIL !!!!!!!! + [Low1/32]BRank(12):score:512(12) R= +8182 p~= 1 FAIL !!!!!!!! + ...and 154 test result(s) without anomalies + + ******************************************************************************* + * + * Conversely, with the murmux3() implementation from from uChaoSys, + * it can pass gigabytes of PractRand test (tested up to 16GB) + * + * ./bboxrnd | ~/robang74/uchaosys/prnd/RNG_test stdin32 + * + * About speed, running 8 threads on a Intel i5-8365, it runs at 1.4GB/s, circa + * + * ( for i in $(seq 1 8); do ./bboxrnd & done; wait; ) | dd bs=1M of=/dev/null + * + * ////////////////////////////////////////////////////////////////////////// */ + #if !defined RANDTEST # include "libbb.h" @@ -32,6 +87,35 @@ # define RAND_BASH_MASK 0xffffffff /* off */ #endif +/* RAF ///////////////////////////////////////////////////////////////////////// + * + * uchaos_dev.h - Character device for uchaos-based jitter hashing + * (c) 2026, Roberto A. Foglietta , GPLv2 + * extracted from: + * https://github.com/robang74/uchaosys/blob/v074/kdev/uchaos_dev.h + * + ******************************************************************************/ + +#define AB (5) +#define ABN (1<>1)-1) // 15 or 31 + +#define murmul1 0xff51afd7ed558ccdULL +#define murmul2 0xc4ceb9fe1a85ec53ULL +#define murmul3 0x9E3779B9045d9f3bULL + +typedef uint32_t archul_t; + +__attribute__((always_inline)) +static inline archul_t murmux3(register archul_t z, register archul_t p) { + z = p ^ ((z >> (ABx-2)) * murmul1); + z = (z ^ ( z << ABx )) * murmul2; + z = z ^ ( z >> (ABx+2)); + return z; +} + +/* ////////////////////////////////////////////////////////////////////////// */ + uint32_t FAST_FUNC next_random(random_t *rnd) { @@ -134,6 +218,8 @@ next_random(random_t *rnd) * It does not add meaningful strength, could use xor operation instead. */ t = rnd->galois_LFSR - rnd->LCG + rnd->xs64_y; + /* RAF, whitening is needed, murmux3() implementation from from uChaoSys */ + t = murmux3(t, (rnd->galois_LFSR + rnd->LCG) ^ rnd->xs64_y); /* bash compat $RANDOM range: */ return t & RAND_BASH_MASK; -- 2.34.1