crypt1080/random-java-generator-wizard
0
1<!DOCTYPE html>2<html lang="en" class="h-full bg-gray-900">3<head>4 <meta charset="UTF-8">5 <meta name="viewport" content="width=device-width, initial-scale=1.0">6 <title>Random Java Generator</title>7 <script src="https://cdn.tailwindcss.com"></script>8 <script src="https://unpkg.com/feather-icons"></script>9 <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>10 <style>11 .code-block {12 font-family: 'Courier New', monospace;13 background-color: #1e293b;14 border-radius: 0.5rem;15 padding: 1.5rem;16 color: #f8fafc;17 border-left: 4px solid #7c3aed;18 }19 .highlight {20 color: #f472b6;21 }22 </style>23</head>24<body class="min-h-full flex flex-col items-center justify-center p-4">25 <div class="max-w-2xl w-full bg-gray-800 rounded-xl shadow-2xl overflow-hidden">26 <div class="p-6 bg-gradient-to-r from-purple-600 to-pink-600">27 <div class="flex items-center">28 <i data-feather="code" class="text-white mr-3"></i>29 <h1 class="text-2xl font-bold text-white">Java Random Generator</h1>30 </div>31 </div>32 33 <div class="p-8">34 <div class="mb-8">35 <h2 class="text-xl font-semibold text-gray-200 mb-4">Random Integer (0-10 inclusive)</h2>36 <div class="code-block">37 <span class="text-gray-400">Random rand = new Random();</span><br>38 <span class="text-gray-400">int n = </span><span class="highlight">rand.nextInt(11)</span><span class="text-gray-400">;</span>39 </div>40 </div>41 42 <div class="bg-gray-700 rounded-lg p-6">43 <div class="flex items-start">44 <i data-feather="info" class="text-purple-400 mr-3 mt-1"></i>45 <div>46 <h3 class="font-medium text-gray-200 mb-2">Implementation Notes</h3>47 <ul class="text-gray-400 space-y-2">48 <li class="flex items-start">49 <i data-feather="chevron-right" class="text-purple-400 mr-2 w-4 h-4"></i>50 <span><span class="text-gray-300">nextInt(11)</span> generates values from 0 (inclusive) to 11 (exclusive)</span>51 </li>52 <li class="flex items-start">53 <i data-feather="chevron-right" class="text-purple-400 mr-2 w-4 h-4"></i>54 <span>Properly handles the inclusive upper bound of 10</span>55 </li>56 <li class="flex items-start">57 <i data-feather="chevron-right" class="text-purple-400 mr-2 w-4 h-4"></i>58 <span>Thread-safe when using separate Random instances</span>59 </li>60 </ul>61 </div>62 </div>63 </div>64 </div>65 66 <div class="px-6 py-4 bg-gray-800 border-t border-gray-700 flex justify-between items-center">67 <span class="text-sm text-gray-400">Theme: Undefined (Dark Mode)</span>68 <button class="flex items-center text-purple-400 hover:text-purple-300 transition-colors">69 <i data-feather="copy" class="mr-2 w-4 h-4"></i>70 <span>Copy Code</span>71 </button>72 </div>73 </div>74 75 <script>76 feather.replace();77 document.querySelector('button').addEventListener('click', () => {78 const code = "int n = rand.nextInt(11);";79 navigator.clipboard.writeText(code);80 81 const button = document.querySelector('button');82 const originalText = button.innerHTML;83 button.innerHTML = '<i data-feather="check" class="mr-2 w-4 h-4"></i><span>Copied!</span>';84 feather.replace();85 86 setTimeout(() => {87 button.innerHTML = originalText;88 feather.replace();89 }, 2000);90 });91 </script>92</body>93</html>94 