// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Build a weighted lookup table // Not compiled or tested in-world // Setup: Put in a spare prim you own. Edit LABELS, WEIGHTS and SAMPLE in zero through just under one; touch. // Stop / restore: Disable or remove the script. It only reports to its owner and does not change prim properties. Reset clears its temporary state. // Notes: Uses a fixed sample so results are reproducible. Substitute a random sample only for nonfinancial play or procedural variation, not security. // License: see LICENSE in this distribution. // Original Incoprea example. MIT. Owner-only calculation; no scene changes. list LABELS=["common","unusual","rare"]; list WEIGHTS=[6.0,3.0,1.0]; float SAMPLE=0.75; default { touch_start(integer detectedCount) { if (llDetectedKey(0) != llGetOwner()) return; integer n=llGetListLength(WEIGHTS); if (n==0 || n!=llGetListLength(LABELS) || SAMPLE<0.0 || SAMPLE>=1.0) { llOwnerSay("Check matching lists and sample range [0,1)."); return; } float total=0.0; integer i; for (i=0; i