| |
| |
| |
| |
| |
| |
| export function random_number(min, max) { |
| min = Math.ceil(Number(min)); |
| max = Math.floor(Number(max)); |
| if (isNaN(min) || isNaN(max) || min > max) { |
| throw new Error("Invalid min or max value."); |
| } |
| return Math.floor(Math.random() * (max - min + 1)) + min; |
| } |
|
|
| export default (input, output) => |
| React.createElement( |
| "div", |
| { className: "bg-indigo-50 border border-indigo-200 rounded-lg p-4" }, |
| React.createElement( |
| "div", |
| { className: "flex items-center mb-2" }, |
| React.createElement( |
| "div", |
| { |
| className: |
| "w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3", |
| }, |
| "🎲", |
| ), |
| React.createElement( |
| "h3", |
| { className: "text-indigo-900 font-semibold" }, |
| "Random Number", |
| ), |
| ), |
| React.createElement( |
| "div", |
| { className: "text-center" }, |
| React.createElement( |
| "div", |
| { className: "text-3xl font-bold text-indigo-600 mb-1" }, |
| output, |
| ), |
| React.createElement( |
| "p", |
| { className: "text-indigo-500 text-xs" }, |
| `Range: ${input.min || "?"} - ${input.max || "?"}`, |
| ), |
| ), |
| ); |
|
|