Skip to content

Commit

Permalink
random num commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Janani-m17 committed Jun 5, 2024
1 parent e9ce38d commit 1b3d87d
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Calculators/Random-Number-Generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Random Number Generator

This is a simple Random Number Generator built using HTML, CSS, and JavaScript.

## Features

- Generates a random number between 1 and 100.
- Attractive blue-themed design.
- Responsive and centered layout.

## How to Use

1. Clone the repository or download the files.
2. Open the `index.html` file in your web browser.
3. Click the "Generate Number" button to see a random number displayed.

## File Structure

- `index.html`: The main HTML file.
- `styles.css`: The CSS file for styling the page.
- `script.js`: The JavaScript file containing the logic for generating a random number.
18 changes: 18 additions & 0 deletions Calculators/Random-Number-Generator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Number Generator</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Random Number Generator</h1>
<p>Click the button to generate a random number.</p>
<button onclick="generateRandomNumber()">Generate Number</button>
<div id="result"></div>
</div>
<script src="script.js"></script>
</body>
</html>
4 changes: 4 additions & 0 deletions Calculators/Random-Number-Generator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function generateRandomNumber() {
const randomNumber = Math.floor(Math.random() * 100) + 1;
document.getElementById('result').innerText = 'Random Number: ' + randomNumber;
}
46 changes: 46 additions & 0 deletions Calculators/Random-Number-Generator/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
body {
background-color: #e0f7fa;
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}

.container {
text-align: center;
background-color: #0288d1;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
color: #fff;
}

h1 {
margin: 0 0 20px;
}

button {
background-color: #0277bd;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 0;
cursor: pointer;
border-radius: 5px;
}

button:hover {
background-color: #01579b;
}

#result {
margin-top: 20px;
font-size: 24px;
font-weight: bold;
}
14 changes: 14 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2192,6 +2192,20 @@ <h3>Generates randomized English alphabets used in brain teaser activities.</h3>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Random Number Generator Calculator</h2>
<h3>Generates a Random Number</h3>
<div class="card-footer">
<a href="./Calculators/Random-Number-Generator/index.html" target="_blank">
<button>Try Now</button>
</a>
<a href="https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Random-Number-Generator" title="Source Code" target="_blank">
<img src="./assets/images/github.png" alt="Source Code"></img>
</a>
</div>
</div>
</div>
<div class="box">
<div class="content">
<h2>Random Word Generator Calculator</h2>
Expand Down

0 comments on commit 1b3d87d

Please sign in to comment.