<section class="diZContainer diZmxAuto diZmy8">
    <h2 class="diZBorderBottom">Random Unique Number Generator</h2>
    <p class="diZTextJustify">This tool generates a random and unique number sequence every time it's called. It combines a random string of digits with a unique identifier based on the current microtime, ensuring that each generated number is both unpredictable and unique. This ensures that generated IDs do not conflict in the future. Use it for various applications where unique identifiers or random tokens are required, such as in cryptographic nonce generation, session identifiers, or unique transaction IDs.</p>
    <div class="diZmy20">
        <?php
            function generateRandomUniqueNumber($length = 10) {
                $randomNumber = '';

                for ($i = 0; $i < $length; $i++) {
                    $randomNumber .= mt_rand(0, 9);
                }

                // Append a unique identifier (based on microtime)
                $uniqueId = uniqid();
                $randomUniqueNumber = $randomNumber . $uniqueId;

                return $randomUniqueNumber;
            }
            // Usage
            $randomUniqueNumber = generateRandomUniqueNumber();
            // echo $randomUniqueNumber;
        ?>
        <div class="diZMaxW500 diZFlexColumn diZItemsCenter diZJustifyCenter diZmxAuto toolsSection">
            <span class="diZDisplayNone" id="copiedNotice">Copied to clipboard</span>
            <div class="diZFlexRow diZItemsCenter diZJustifyCenter">
                <h2 id="randomNumber"><?php echo $randomUniqueNumber; ?></h2> &nbsp;
                <span title="Click to copy Siliconid!" onclick="copyToClipboard()" class="diZCursorPointer"><img src="/assets/svg/copy.svg" /></span>
            </div>
        </div>
        <div>
            <h3>Usage:</h3>
            <ul>
                <li class="diZTextJustify"><strong>Order and Transaction IDs:</strong> Generate unique identifiers for orders and transactions in e-commerce platforms to ensure each transaction is uniquely identified and tracked.</li>
                <li class="diZTextJustify"><strong>Session IDs:</strong> Use unique numbers as session identifiers in web applications to manage user sessions securely and uniquely.</li>
                <li class="diZTextJustify"><strong>Cryptographic Nonces:</strong> Generate random tokens for cryptographic nonces in security-sensitive operations to prevent replay attacks and ensure message integrity.</li>
                <li class="diZTextJustify"><strong>API Tokens:</strong> Create unique tokens for API authentication and authorization purposes, ensuring secure and verifiable access to APIs.</li>
                <li class="diZTextJustify"><strong>Coupon and Voucher Codes:</strong> Generate unique codes for promotional coupons and vouchers to track redemptions and prevent duplication.</li>
                <li class="diZTextJustify"><strong>Database Keys:</strong> Generate unique primary keys or identifiers for database records to ensure data integrity and efficient data retrieval.</li>
                <li class="diZTextJustify"><strong>Logging and Tracking:</strong> Use unique numbers as tracking IDs in logging systems to uniquely identify and trace events or actions within applications.</li>
                <li class="diZTextJustify"><strong>Password Reset Tokens:</strong> Generate unique tokens for password reset links sent via email to securely verify and authorize password changes.</li>
            </ul>
        </div>
    </div>
</section>
<script>
    function copyToClipboard() {
        var copyText = document.getElementById('randomNumber');
        var textArea = document.createElement('textarea');
        textArea.value = copyText.textContent.trim();
        document.body.appendChild(textArea);
        textArea.select();
        document.execCommand('copy');
        document.body.removeChild(textArea); //copiedNotice
        setTimeout(() => {
            document.getElementById('copiedNotice').style.display = 'none';
        }, 1000);
        document.getElementById('copiedNotice').style.display = 'block';
        

    }
</script>
