Random Sentence Generator



Advanced Random Sentence Generator


Generate clean, random sentences using a free API. Choose how many and how they’re displayed—all within your browser.













 





About This Tool


Fetches random words from a free API and builds simple, grammatically complete sentences. Ideal for writing prompts, mockups, or content filler.
Random Sentence Generator

Pro Tips:



  • Generate up to 100 sentences at once.

  • 'New Line' adds fresh lines; 'Continue' keeps text flowing.

  • 'Copy' quickly grabs the text; 'Clear' resets.

  • No data leaves your browser—fully private.


How to Use:



  1. Enter how many sentences (1–100).

  2. Select display formatting mode.

  3. Click 'Generate Sentences'.

  4. Copy or clear as needed.



copyright>// async function generateSentences() {
const count = parseInt(document.getElementById("sentenceCount").value);
const displayMode = document.getElementById("displayMode").value;
const output = document.getElementById("outputArea");

if (isNaN(count) || count < 1 || count > 100) {
alert("Enter a valid number between 1 and 100.");
return;
}

output.value = "Generating…";

try {
const res = await fetch(`https://random-word-api.herokuapp.com/word?number=${count * 3}`);
const words = await res.json();

const sentences = [];
for (let i = 0; i < count; i++) {
const slice = words.slice(i * 3, i * 3 + 3);
let s = slice.join(' ');
s = s.charAt(0).toUpperCase() + s.slice(1) + '.';
sentences.push(s);
}

output.value = displayMode === 'newline' ? sentences.join('n') : sentences.join(' ');
} catch {
output.value = "Error fetching sentences. Please try again.";
}
}

function clearOutput() {
document.getElementById("outputArea").value = "";
}

function copyOutput() {
const ta = document.getElementById("outputArea");
if (!ta.value.trim()) {
alert("Nothing to copy.");
return;
}
ta.select();
document.execCommand("copy");
alert("Copied to clipboard!");
}
// ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *