https://github.com/robertoaleman/randomstringchecker
RandomStringChecker, designed to evaluate whether a given string is random according to specific criteria.
https://github.com/robertoaleman/randomstringchecker
key-evaluator php php8 text-processing
Last synced: 3 months ago
JSON representation
RandomStringChecker, designed to evaluate whether a given string is random according to specific criteria.
- Host: GitHub
- URL: https://github.com/robertoaleman/randomstringchecker
- Owner: robertoaleman
- License: mit
- Created: 2025-03-17T01:20:31.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-17T01:35:06.000Z (3 months ago)
- Last Synced: 2025-03-17T02:34:49.277Z (3 months ago)
- Topics: key-evaluator, php, php8, text-processing
- Language: PHP
- Homepage: https://ventics.com
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RandomStringChecker
RandomStringChecker, Designed to evaluate whether a given string is random according to specific criteria.Author: Roberto Aleman
Web: ventics.com
License: MIT
Created: March 16, 2025The provided PHP code defines a class called
RandomStringChecker
, which is designed to evaluate whether a given string is random based on specific criteria. Here’s a breakdown of what the code does:
- Class Definition: The
RandomStringChecker
class is initialized with a string that you want to check for randomness.
Randomness Check: The main method,isRandom()
, performs several checks on the string:
Length Check: It first checks if the string has at least 10 characters. If not, it returns a message indicating that the string is not random due to insufficient length.
Character Diversity Check: It verifies that the string contains a mix of letters (both uppercase and lowercase), numbers, and special characters. If the string lacks this diversity, it returns a message stating that the string is not random.
Repetitive Patterns Check: The method checks for repetitive patterns within the string. If it finds any character repeated three or more times consecutively, it concludes that the string is not random.
Ascending and Descending Sequences Check: The code includes additional checks for ascending or descending sequences of characters. If such sequences are found, the string is deemed not random.
- Reporting Results: The
report()
method calls theisRandom()
method and returns a message indicating whether the string is random or not, along with the reason if it is not.
- Example Usage: The code includes examples of how to create instances of the
RandomStringChecker
class and check various strings. It demonstrates different scenarios, including strings that are not random due to length, repetitive patterns, or sequences.
Overall, this code provides a structured way to assess the randomness of strings, making it useful for applications where random string generation is important, such as password creation or token generation.
Do you like the code?
Need more? Write to me and I can customize it for your project.