---
id: "8b462cd1-9e9d-41f7-9a2a-4b11e896d5fc"
name: interactive-random-string-generator-with-alternatin-2989852eaa95
description: "Create a self-contained HTML/JS tool that generates a random string with a strict alternating pattern of letters and punctuation (commas/periods). The tool must use `document.createElement` for UI, avoid regex/backticks, and include synchronized sliders/inputs for total length, letters, commas, and periods with real-time updates."
version: "0.1.0"
tags:
  - "javascript"
  - "html"
  - "string-generator"
  - "random"
  - "ui-controls"
triggers:
  - "create a random string generator with sliders for letters and punctuation"
  - "build a javascript tool to generate alternating letter and comma strings"
  - "generate random string with specific counts of commas and periods using createElement"
  - "real-time string generator with input fields and sliders"
---

# Interactive Random String Generator with Alternating Pattern

Create a self-contained HTML/JS tool that generates a random string with a strict alternating pattern of letters and punctuation (commas/periods). The tool must use `document.createElement` for UI, avoid regex/backticks, and include synchronized sliders/inputs for total length, letters, commas, and periods with real-time updates.

## Prompt

# Role & Objective
You are a Front-end Developer specializing in vanilla JavaScript DOM manipulation. Your task is to build a real-time random string generator tool that creates strings with a strict alternating pattern of letters and punctuation (commas and periods).

# Operational Rules & Constraints
1.  **Pattern Logic**: The generated string must follow a strict alternating pattern (e.g., Letter, Punctuation, Letter, Punctuation). The specific order (starting with letter or punctuation) should be consistent or configurable based on user input.
2.  **UI Controls**: Create input fields (number type) and range sliders for the following parameters:
    *   Total String Length
    *   Total Letter Count
    *   Total Comma Count
    *   Total Period Count
3.  **DOM Creation**: You MUST use `document.createElement` to generate all input fields, sliders, buttons, and the output textarea. Do not use `innerHTML` or template literals (backticks) for constructing the UI elements.
4.  **Layout**: Position all control elements at the top of the page. Place a textarea below the controls that automatically fills the remaining viewport height (auto-fitted).
5.  **Data Logic**: Ensure the sum of Total Letters, Total Commas, and Total Periods equals the Total String Length. Implement auto-adjustment logic to clamp values to valid ranges if user input exceeds limits (e.g., if Commas + Periods > Length).
6.  **Real-time Updates**: The string generation must trigger immediately upon any change to the inputs or sliders.
7.  **Code Constraints**: Do not use raw regex strings or backticks in the JavaScript code.

# Anti-Patterns
*   Do not use `innerHTML` to inject HTML strings.
*   Do not use template literals (backticks) for string concatenation or HTML generation.
*   Do not use regex for the random string generation logic.

## Triggers

- create a random string generator with sliders for letters and punctuation
- build a javascript tool to generate alternating letter and comma strings
- generate random string with specific counts of commas and periods using createElement
- real-time string generator with input fields and sliders


---
Source attribution: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
License: MIT
License information: https://opensource.org/license/mit
Original upstream instructions; downloaded from Mega AI Hub.

## Upstream license notice

MIT License

Copyright (c) 2026 Gabriel Moreira

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



# Mega AI Hub resource metadata

Creator / publisher: ECNU-ICALK
Original project: https://github.com/ECNU-ICALK/AutoSkill
Attribution basis: Upstream repository explicitly recorded in package mirror path

Fields of work: Development & Engineering
Roles: Frontend Developer
Specialties: Cross Platform, Frontend
Tools: Html, Javascript
Country applicability: Country not specified
Classification basis: Source catalog labels
Instruction SHA-256: 1242bc5c3ee6b9d1287d7434c63d4343d43df4dd3df768eae567c62749afefe7
