ShareShortcuts

RNG

For random numbers and maybe for bets or sumthin but use the app icon provided by me

vie_gamdev
Fork “RNG”

Built something new on top of this Shortcut? Share it as a fork: it becomes a Shortcut of your own, which you manage, and both pages link to each other so vie_gamdev gets credit.

  1. 1Get the Shortcut and change it in the Shortcuts app. Give it a name of its own.
  2. 2Share it from the Shortcuts app and copy the iCloud link.
  3. 3Come back here, paste the link and describe what is different, e.g. “Added a step that uses Apple Intelligence to personalise the text.”
Downloads
2K
Saved
0
Actions
3
Category
API
Version
1.0
Language
EN

Preview

For random numbers and maybe for bets or sumthin but use the app icon provided by me

What's New

Version 1.0

First release

Version History
1.0 Sep 5, 2026

First release

What it does

3 actions
  1. Text
  2. Set Name
  3. Show Web Page

View as code
Beta

Every action of this Shortcut written out as Cherri, a programming language for Shortcuts. Great for learning how it works.

#include 'actions/web'
#define color darkorange

const Text = "<!DOCTYPE html>\n<html lang=\\"en\\">\n<head>\n    <meta charset=\\"UTF-8\\">\n    <meta name=\\"viewport\\" content=\\"width=device-width, initial-scale=1.0\\">\n    <title>Random Number Generator</title>\n    <style>\n        :root {\n            --bg-color: #0f172a;\n            --card-bg: #1e293b;\n            --accent-color: #38bdf8;\n            --text-main: #f8fafc;\n            --text-muted: #94a3b8;\n        }\n\n        body {\n            font-family: -apple-system, BlinkMacSystemFont, \\"Segoe UI\\", Roboto, Helvetica, Arial, sans-serif;\n            background-color: var(--bg-color);\n            color: var(--text-main);\n            margin: 0;\n            padding: 20px;\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            min-height: 100vh;\n            box-sizing: border-box;\n        }\n\n        .container {\n            width: 100%;\n            max-width: 600px;\n            background-color: var(--card-bg);\n            padding: 30px;\n            border-radius: 12px;\n            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);\n        }\n\n        h1 {\n            font-size: 1.5rem;\n            margin-top: 0;\n            margin-bottom: 5px;\n            color: var(--accent-color);\n        }\n\n        p.subtitle {\n            color: var(--text-muted);\n            margin-bottom: 25px;\n            font-size: 0.9rem;\n        }\n\n        .display-box {\n            background-color: rgba(0, 0, 0, 0.2);\n            border: 2px solid #334155;\n            border-radius: 8px;\n            padding: 20px;\n            text-align: center;\n            margin-bottom: 25px;\n        }\n\n        .current-number {\n            font-family: monospace;\n            font-size: 3.5rem;\n            font-weight: bold;\n            color: var(--text-main);\n            margin: 10px 0;\n        }\n\n        .controls {\n            margin-bottom: 25px;\n        }\n\n        .control-group {\n            display: flex;\n            flex-direction: column;\n            gap: 8px;\n        }\n\n        label {\n            font-weight: 600;\n            font-size: 0.9rem;\n            display: flex;\n            justify-content: space-between;\n        }\n\n        .speed-val {\n            color: var(--accent-color);\n            font-family: monospace;\n        }\n\n        input[type=\\"range\\"] {\n            width: 100%;\n            accent-color: var(--accent-color);\n            cursor: pointer;\n        }\n\n        .database-section {\n            border-top: 1px solid #334155;\n            padding-top: 20px;\n        }\n\n        .db-header {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            margin-bottom: 15px;\n        }\n\n        .db-title {\n            font-weight: 600;\n            font-size: 1.1rem;\n        }\n\n        .row-count {\n            font-size: 0.8rem;\n            background-color: #334155;\n            padding: 2px 8px;\n            border-radius: 10px;\n            font-family: monospace;\n        }\n\n        .table-wrapper {\n            max-height: 200px;\n            overflow-y: auto;\n            border: 1px solid #334155;\n            border-radius: 6px;\n            background-color: rgba(0, 0, 0, 0.1);\n        }\n\n        table {\n            width: 100%;\n            border-collapse: collapse;\n            font-family: monospace;\n            font-size: 0.85rem;\n            text-align: left;\n        }\n\n        th, td {\n            padding: 10px;\n            border-bottom: 1px solid #334155;\n        }\n\n        th {\n            background-color: #1e293b;\n            position: sticky;\n            top: 0;\n            color: var(--text-muted);\n        }\n\n        tr:last-child td {\n            border-bottom: none;\n        }\n    </style>\n</head>\n<body>\n\n    <div class=\\"container\\">\n        <h1>Random Number Generator</h1>\n        <p class=\\"subtitle\\">Generates automated mock database inputs for training logic.</p>\n\n        <!-- Current Output Display -->\n        <div class=\\"display-box\\">\n            <label style=\\"color: var(--text-muted);\\">GENERATED VALUE (0 - 9999)</label>\n            <div class=\\"current-number\\" id=\\"randomNumber\\">----</div>\n        </div>\n\n        <!-- Speed Modifier System -->\n        <div class=\\"controls\\">\n            <div class=\\"control-group\\">\n                <label for=\\"speedSlider\\">\n                    <span>Generation Speed Multiplier</span>\n                    <span class=\\"speed-val\\" id=\\"speedDisplay\\">1x (1000ms)</span>\n                </label>\n                <!-- Max speed increased to 100,000x -->\n                <input type=\\"range\\" id=\\"speedSlider\\" min=\\"1\\" max=\\"100000\\" value=\\"1\\">\n            </div>\n        </div>\n\n        <!-- Simulated Early-Level Database Storage -->\n        <div class=\\"database-section\\">\n            <div class=\\"db-header\\">\n                <span class=\\"db-title\\">Local DB Log (Max 20 Rows)</span>\n                <span class=\\"row-count\\" id=\\"rowCount\\">0 rows</span>\n            </div>\n            <div class=\\"table-wrapper\\">\n                <table>\n                    <thead>\n                        <tr>\n                            <th>Row_ID</th>\n                            <th>Timestamp</th>\n                            <th>Value</th>\n                        </tr>\n                    </thead>\n                    <tbody id=\\"dbLog\\">\n                        <!-- Data inserts dynamically here -->\n                    </tbody>\n                </table>\n            </div>\n        </div>\n    </div>\n\n    <script>\n        const randomNumberEl = document.getElementById('randomNumber');\n        const speedSlider = document.getElementById('speedSlider');\n        const speedDisplay = document.getElementById('speedDisplay');\n        const dbLog = document.getElementById('dbLog');\n        const rowCountEl = document.getElementById('rowCount');\n\n        const BASE_DELAY = 1000; // Base interval is 1 second (1000ms)\n        let generatorTimeout = null;\n        let entryId = 0;\n\n        // Core Generator Logic Loop\n        function runGenerator() {\n            // Calculate timing delay based on new 100,000x multiplier scale\n            const currentMultiplier = parseInt(speedSlider.value, 10);\n            const nextDelay = BASE_DELAY / currentMultiplier;\n\n            // Performance optimizations for extreme speeds (>= 10,000x)\n            // Loops batches within a single animation frame to keep up with the requested math without skipping beats\n            if (currentMultiplier >= 10000) {\n                const batchSize = Math.floor(currentMultiplier / 1000);\n                for (let i = 0; i < batchSize; i++) {\n                    generateSingleTick();\n                }\n                generatorTimeout = setTimeout(runGenerator, 1);\n            } else {\n                generateSingleTick();\n                generatorTimeout = setTimeout(runGenerator, nextDelay);\n            }\n        }\n\n        function generateSingleTick() {\n            // 1. Generate number between 0 and 9999\n            const newNumber = Math.floor(Math.random() * 10000);\n            \n            // 2. Display the number on screen\n            randomNumberEl.textContent = newNumber;\n\n            // 3. Write data directly to our simulated database log\n            insertIntoSimulatedDB(newNumber);\n        }\n\n        // Database Simulation Insertion Logic\n        function insertIntoSimulatedDB(value) {\n            entryId++;\n            const timestamp = new Date().toISOString().split('T').slice(0, -1); // Extract HH:MM:SS.mmm\n\n            // Create row node\n            const row = document.createElement('tr');\n            row.innerHTML = `\n                <td style=\\"color: var(--text-muted);\\">${entryId}</td>\n                <td>${timestamp}</td>\n                <td style=\\"color: var(--accent-color); font-weight: bold;\\">${value}</td>\n            `;\n\n            // Insert newest data at the very top of the log\n            dbLog.insertBefore(row, dbLog.firstChild);\n\n            // Row cap lowered to 20 to protect browser memory and prevent lagging at ultra-high 100,000x loops\n            if (dbLog.children.length > 20) {\n                dbLog.removeChild(dbLog.lastChild);\n            }\n\n            rowCountEl.textContent = `${entryId} records`;\n        }\n\n        // Event listener to monitor slider changes and update visual readouts instantly\n        speedSlider.addEventListener('input', (e) => {\n            const val = parseInt(e.target.value, 10);\n            const currentDelayMs = (BASE_DELAY / val).toFixed(4);\n            speedDisplay.textContent = `${val.toLocaleString()}x (${currentDelayMs}ms)`;\n            \n            // Instantly clear future loops to adapt to speed changes immediately\n            clearTimeout(generatorTimeout);\n            runGenerator();\n        });\n\n        // Initialize system loop automatically on page run\n        runGenerator();\n    </script>\n</body>\n</html>\n"
setName(Text, "Random.html")
showWebpage()
Decompiled with cherri 2.3.0 (GPL-2.0). May need small fixes before it compiles.

Ratings & Reviews

Write a Review
–
out of 5
★★★★★
★★★★
★★★
★★
★
0 ratings

No reviews yet. Be the first to share what you think!

Advertisement

More by vie_gamdev

See All

You Might Also Like

See All
Advertisement