├── .gitignore ├── .vscode └── settings.json ├── tsconfig.json ├── LICENSE ├── package.json ├── src ├── FunctonalBased.tsx └── index.ts └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /lib -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "Asghar", 4 | "randomizex" 5 | ] 6 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "module": "commonjs", 5 | "declaration": true, 6 | "outDir": "./lib", 7 | "strict": true 8 | }, 9 | "include": ["src"], 10 | "exclude": ["node_modules", "**/__test__/*"] 11 | } 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Ali Asghar 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "randomizex", 3 | "version": "1.0.13", 4 | "description": "Generate Random UUID, Id, Number, Password, String Creation, Boolean Values, Array Shuffle, Array Pick, Date Generation, Hex Values and more.", 5 | "main": "lib/index.js", 6 | "types": "lib/index.d.ts", 7 | "scripts": { 8 | "build": "tsc", 9 | "prepare": "npm run build" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/AliAsgharGill/randomizex.git" 14 | }, 15 | "keywords": [ 16 | "random-number-generator", 17 | "random-string-generator", 18 | "random-unique-identifier", 19 | "random-password-generator", 20 | "test-data-generation", 21 | "JavaScript-random-number", 22 | "JavaScript-random-string", 23 | "Node-js-random", 24 | "cryptographically-secure-random", 25 | "customizable-random-generation", 26 | "Random data generator", 27 | "String generator", 28 | "Number generator", 29 | "Email generator", 30 | "Phone number generator", 31 | "Date generator", 32 | "Boolean generator", 33 | "IP address generator", 34 | "Color code generator", 35 | " Credit card number generator", 36 | " Array generator", 37 | " TypeScript utility", 38 | " Randomize tool", 39 | " Development library", 40 | " Programming helper", 41 | " Generate random values", 42 | " TypeScript random data", 43 | " RandomizeX utility", 44 | " Random data generation library", 45 | " TypeScript development tool", 46 | "RandomizeX library", 47 | "Random data generation", 48 | "Data randomization tool", 49 | "Random value generator", 50 | "JavaScript randomization", 51 | "Data mockup tool", 52 | "Random string generator", 53 | "Random number generator", 54 | "Data randomization library", 55 | " Secure random data", 56 | " JavaScript data randomization", 57 | " Randomization utility", 58 | " Mock data generator", 59 | " JavaScript random data tool", 60 | " Secure data generation", 61 | " Randomization in JavaScript", 62 | " Random data API", 63 | " Randomization package", 64 | " JavaScript randomizer", 65 | " Random data creation utility", 66 | "Generate Random UUID", "RandomIdNumber", "Random Password", " Random String Creation", "Random Boolean Values", "Random Array Shuffle", "Random Array", "Random Date Generation", "Random Hex Values" 67 | ], 68 | "author": "Ali Asghar Gill", 69 | "license": "MIT", 70 | "bugs": { 71 | "url": "https://github.com/AliAsgharGill/randomizex/issues" 72 | }, 73 | "homepage": "https://github.com/AliAsgharGill/randomizex#readme", 74 | "devDependencies": { 75 | "typescript": "^5.4.5" 76 | }, 77 | "files": [ 78 | "lib/**/*" 79 | ] 80 | } 81 | -------------------------------------------------------------------------------- /src/FunctonalBased.tsx: -------------------------------------------------------------------------------- 1 | // const RandomizeX = { 2 | // idSet: new Set(), 3 | 4 | // Id: (length: number = 16): string => { 5 | // const chars: string = 6 | // "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"; 7 | // let result: string = ""; 8 | // while (result.length < length) { 9 | // const randomChar = chars.charAt( 10 | // Math.floor(Math.random() * chars.length) 11 | // ); 12 | // result += randomChar; 13 | // } 14 | 15 | // const id = parseInt(result, 36); 16 | // if (RandomizeX.idSet.has(id)) { 17 | // return RandomizeX.Id(length); 18 | // } 19 | 20 | // RandomizeX.idSet.add(id); 21 | 22 | // let formattedResult = ""; 23 | // for (let i = 0; i < result.length; i++) { 24 | // if (i > 0 && i % 4 === 0) { 25 | // formattedResult += "-"; 26 | // } 27 | // formattedResult += result[i]; 28 | // } 29 | 30 | // return formattedResult; 31 | // }, 32 | 33 | // Sentence: (sentenceLength: number = 6): string => { 34 | // const words: string[] = [ 35 | // "Lorem", 36 | // "ipsum", 37 | // "dolor", 38 | // "sit", 39 | // "amet", 40 | // "consectetur", 41 | // "adipiscing", 42 | // "elit", 43 | // "sed", 44 | // "do", 45 | // "eiusmod", 46 | // "tempor", 47 | // "incididunt", 48 | // "ut", 49 | // "labore", 50 | // "et", 51 | // "dolore", 52 | // "magna", 53 | // "aliqua", 54 | // "gill", 55 | // ]; 56 | 57 | // let result: string = ""; 58 | // for (let i = 0; i < sentenceLength; i++) { 59 | // const randomIndex = Math.floor(Math.random() * words.length); 60 | // result += words[randomIndex] + " "; 61 | // } 62 | 63 | // result = result.charAt(0).toUpperCase() + result.slice(1, -1) + "."; 64 | 65 | // return result; 66 | // }, 67 | 68 | // Number: (min: number = 0, max: number = 100): number => { 69 | // return Math.floor(Math.random() * (max - min + 1)) + min; 70 | // }, 71 | 72 | // Email: (): string => { 73 | // const domains: string[] = [ 74 | // "gmail.com", 75 | // "yahoo.com", 76 | // "hotmail.com", 77 | // "example.com", 78 | // ]; 79 | // const domain: string = RandomizeX.Element(domains); 80 | // const usernameLength: number = RandomizeX.Number(5, 10); // Random username length between 5 and 10 81 | // let username: string = ""; 82 | // const chars: string = "abcdefghijklmnopqrstuvwxyz0123456789"; 83 | // for (let i = 0; i < usernameLength; i++) { 84 | // username += chars.charAt(Math.floor(Math.random() * chars.length)); 85 | // } 86 | // return `${username}@${domain}`; 87 | // }, 88 | 89 | // Boolean: (): boolean => { 90 | // return Math.random() < 0.5; 91 | // }, 92 | 93 | // Date: (start: Date = new Date(2000, 0, 1), end: Date = new Date()): Date => { 94 | // return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime())); 95 | // }, 96 | 97 | // PhoneNumber: (): string => { 98 | // const countryCode: number = RandomizeX.Number(100, 999); // Random 3-digit country code 99 | // const areaCode: number = RandomizeX.Number(100, 999); // Random 3-digit area code 100 | // const subscriberNumber: number = RandomizeX.Number(1000, 9999); // Random 4-digit subscriber number 101 | // return `+${countryCode}-${areaCode}-${subscriberNumber}`; 102 | // }, 103 | 104 | // IpAddress: (): string => { 105 | // const octet = (): number => Math.floor(Math.random() * 256); 106 | // return `${octet()}.${octet()}.${octet()}.${octet()}`; 107 | // }, 108 | 109 | // Url: (): string => { 110 | // const protocols: string[] = ["http", "https"]; 111 | // const protocol: string = RandomizeX.Element(protocols); 112 | // const domain: string = RandomizeX.Sentence(1).replace(".", "").toLowerCase(); // Random domain name 113 | // const pathLength: number = RandomizeX.Number(1, 10); // Random path length between 1 and 10 114 | // let path: string = ""; 115 | // for (let i = 0; i < pathLength; i++) { 116 | // path += "/" + RandomizeX.Sentence(1).toLowerCase().replace(".", ""); 117 | // } 118 | // return `${protocol}://${domain}${path}`; 119 | // }, 120 | 121 | // Color: (): string => { 122 | // const randomColor: string = Math.floor(Math.random() * 16777215).toString(16); // Generate random hexadecimal color code 123 | // return `#${randomColor}`; 124 | // }, 125 | 126 | // CreditCardNumber: (): string => { 127 | // const firstDigit: number = RandomizeX.Number(1, 9); // Random number between 1 and 9 for the first digit 128 | // let ccNumber: string = `${firstDigit}`; 129 | // for (let i = 0; i < 15; i++) { 130 | // ccNumber += RandomizeX.Number(0, 9); // Random digits for the rest of the credit card number 131 | // } 132 | // return ccNumber; 133 | // }, 134 | 135 | // BooleanArray: (length: number = 5): boolean[] => { 136 | // return Array.from({ length }, () => Math.random() < 0.5); 137 | // }, 138 | 139 | // IntArray: (length: number = 5, min: number = 0, max: number = 100): number[] => { 140 | // return Array.from({ length }, () => RandomizeX.Number(min, max)); 141 | // }, 142 | 143 | // Element: (array: T[]): T => { 144 | // return array[Math.floor(Math.random() * array.length)]; 145 | // }, 146 | 147 | // BooleanWithProbability: (probability: number): boolean => { 148 | // return Math.random() < probability; 149 | // }, 150 | 151 | // String: (length: number, chars: string): string => { 152 | // let result = ""; 153 | // for (let i = 0; i < length; i++) { 154 | // result += chars.charAt(Math.floor(Math.random() * chars.length)); 155 | // } 156 | // return result; 157 | // }, 158 | 159 | // DateInRange: (startDate: Date, endDate: Date): Date => { 160 | // return new Date(startDate.getTime() + Math.random() * (endDate.getTime() - startDate.getTime())); 161 | // }, 162 | 163 | // Time: (): string => { 164 | // const hours = RandomizeX.Number(0, 23); 165 | // const minutes = RandomizeX.Number(0, 59); 166 | // const seconds = RandomizeX.Number(0, 59); 167 | // return `${hours.toString().padStart(2, "0")}:${minutes.toString().padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; 168 | // }, 169 | 170 | // FileName: (extension: string): string => { 171 | // return RandomizeX.String(10, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") + "." + extension; 172 | // }, 173 | 174 | // HexColor: (): string => { 175 | // const randomColor: string = Math.floor(Math.random() * 16777215).toString(16); // Generate random hexadecimal color code 176 | // return `#${randomColor.padStart(6, "0")}`; 177 | // }, 178 | 179 | // IPv6Address: (): string => { 180 | // let address = ""; 181 | // for (let i = 0; i < 8; i++) { 182 | // address += Math.floor(Math.random() * 65535).toString(16).padStart(4, "0"); 183 | // if (i < 7) { 184 | // address += ":"; 185 | // } 186 | // } 187 | // return address; 188 | // }, 189 | 190 | // MACAddress: (): string => { 191 | // let address = ""; 192 | // for (let i = 0; i < 6; i++) { 193 | // address += Math.floor(Math.random() * 256).toString(16).padStart(2, "0"); 194 | // if (i < 5) { 195 | // address += ":"; 196 | // } 197 | // } 198 | // return address; 199 | // }, 200 | 201 | // GUID: (): string => { 202 | // return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { 203 | // const r = Math.random() * 16 | 0; 204 | // const v = c === "x" ? r : (r & 0x3 | 0x8); 205 | // return v.toString(16); 206 | // }); 207 | // }, 208 | 209 | // Currency: (): string => { 210 | // const currencies: string[] = ["USD", "EUR", "GBP", "JPY", "AUD", "CAD", "CHF", "CNY", "SEK", "NZD"]; 211 | // return RandomizeX.Element(currencies); 212 | // }, 213 | 214 | // Country: (): string => { 215 | // const countries: string[] = ["USA", "Germany", "UK", "France", "Italy", "Japan", "China", "Canada", "Australia", "Brazil"]; 216 | // return RandomizeX.Element(countries); 217 | // }, 218 | 219 | // City: (): string => { 220 | // const cities: string[] = ["New York", "London", "Paris", "Tokyo", "Berlin", "Sydney", "Rome", "Madrid", "Toronto", "Moscow"]; 221 | // return RandomizeX.Element(cities); 222 | // }, 223 | 224 | // StreetAddress: (): string => { 225 | // const streetNames: string[] = ["Main Street", "High Street", "Park Avenue", "Broadway", "Sunset Boulevard", "Abbey Road", "Baker Street"]; 226 | // const streetNumber = RandomizeX.Number(1, 999); 227 | // return `${streetNumber} ${RandomizeX.Element(streetNames)}`; 228 | // }, 229 | 230 | // PostalCode: (): string => { 231 | // const postalCode = RandomizeX.Number(10000, 99999); 232 | // return postalCode.toString(); 233 | // }, 234 | 235 | // Latitude: (): number => { 236 | // return Math.random() * (90 - (-90)) + (-90); 237 | // }, 238 | 239 | // Longitude: (): number => { 240 | // return Math.random() * (180 - (-180)) + (-180); 241 | // }, 242 | 243 | // HTTPMethod: (): string => { 244 | // const methods: string[] = ["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]; 245 | // return RandomizeX.Element(methods); 246 | // }, 247 | 248 | // MimeType: (): string => { 249 | // const mimeTypes: string[] = [ 250 | // "application/json", 251 | // "text/plain", 252 | // "image/jpeg", 253 | // "image/png", 254 | // "application/pdf", 255 | // "application/xml", 256 | // "text/html", 257 | // "text/css", 258 | // "application/javascript" 259 | // ]; 260 | // return RandomizeX.Element(mimeTypes); 261 | // }, 262 | // }; 263 | 264 | // export default RandomizeX; -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RandomizeX 2 | You're in the right place! Just install the **RandomizeX** package to solve all your problems related to generating random data. 3 | 4 | ## Installation 5 | 6 | You can install RandomizeX via npm: 7 | 8 | ```sh 9 | npm install randomizex 10 | ``` 11 | 12 | ### Using RandomizeX with JavaScript/TypeScript Modules (`type: module`) 13 | 14 | #### Usage 15 | 16 | ```JavaScript 17 | // Import RandomizeX functions 18 | import { RandomizeX } from 'randomizex'; 19 | 20 | // Use the functions 21 | const randomId = RandomizeX.Id(); 22 | const randomSentence = RandomizeX.Sentence(); 23 | const randomNumber = RandomizeX.Number(); 24 | ``` 25 | 26 | ### Using RandomizeX with CommonJS Modules (`type: commonjs`) 27 | 28 | #### Usage 29 | 30 | ```javascript 31 | // Require RandomizeX functions 32 | const {RandomizeX } = require('randomizex'); 33 | 34 | // Use the functions 35 | const randomId = RandomizeX.Id(); 36 | const randomSentence = RandomizeX.Sentence(); 37 | const randomNumber = RandomizeX.Number(); 38 | ``` 39 | 40 | ### Note: 41 | 42 | - When using JavaScript/TypeScript with `type: module`, you can directly import the functions from RandomizeX. 43 | - When using CommonJS, you need to use `require` to import the functions. 44 | - Ensure your `tsconfig.json` is configured correctly for the module type you're using. 45 | 46 | 47 | ## Usage 48 | 49 | Once installed, you can import RandomizeX into your JavaScript/JavaScript/TypeScript code and start using its functions: 50 | 51 | **More Then 130+ Functionalities** 52 | 53 | ```javascript 54 | 55 | import { RandomizeX } from 'randomizex'; 56 | 57 | // Generate a random string with a length of 16 characters 58 | 59 | const randomString = RandomizeX.Id(); 60 | 61 | console.log(randomString); // Output: e.g., "a3Fg-5hRt-8kLp-..." 62 | 63 | 64 | 65 | // Generate a random sentence with 6 words 66 | 67 | const randomSentence = RandomizeX.Sentence(); 68 | 69 | console.log(randomSentence); // Output: e.g., "Lorem ipsum dolor sit amet." 70 | 71 | 72 | 73 | // Generate a random number between 0 and 100 (inclusive) 74 | 75 | const randomNumber = RandomizeX.Number(); 76 | 77 | console.log(randomNumber); // Output: e.g., 42 78 | 79 | 80 | 81 | // Generate a random email address 82 | 83 | const randomEmail = RandomizeX.Email(); 84 | 85 | console.log(randomEmail); // Output: e.g., "example@example.com" 86 | 87 | 88 | 89 | // Generate a random boolean value (true or false) 90 | 91 | const randomBoolean = RandomizeX.Boolean(); 92 | 93 | console.log(randomBoolean); // Output: e.g., true 94 | 95 | 96 | 97 | // Generate a random date between January 1, 2000, and the current date 98 | 99 | const randomDate = RandomizeX.Date(); 100 | 101 | console.log(randomDate); // Output: e.g., "Sat Jun 10 2006 02:04:32 GMT+0300 (East Africa Time)" 102 | 103 | 104 | 105 | // Generate a random phone number 106 | 107 | const randomPhoneNumber = RandomizeX.PhoneNumber(); 108 | 109 | console.log(randomPhoneNumber); // Output: e.g., "+123-456-7890" 110 | 111 | 112 | 113 | // Generate a random IP address 114 | 115 | const randomIpAddress = RandomizeX.IpAddress(); 116 | 117 | console.log(randomIpAddress); // Output: e.g., "192.168.1.1" 118 | 119 | 120 | 121 | // Generate a random URL 122 | 123 | const randomUrl = RandomizeX.Url(); 124 | 125 | console.log(randomUrl); // Output: e.g., "http://example.com/some/path" 126 | 127 | 128 | 129 | // Generate a random color in hexadecimal format 130 | 131 | const randomColor = RandomizeX.Color(); 132 | 133 | console.log(randomColor); // Output: e.g., "#1a2b3c" 134 | 135 | 136 | 137 | // Generate a random credit card number 138 | 139 | const randomCreditCardNumber = RandomizeX.CreditCardNumber(); 140 | 141 | console.log(randomCreditCardNumber); // Output: e.g., "4916577212820895" 142 | 143 | 144 | 145 | // Generate an array of 5 random boolean values 146 | 147 | const randomBooleanArray = RandomizeX.BooleanArray(); 148 | 149 | console.log(randomBooleanArray); // Output: e.g., [true, false, true, true, false] 150 | 151 | 152 | 153 | // Generate an array of 5 random integers between 0 and 100 154 | 155 | const randomIntArray = RandomizeX.IntArray(); 156 | 157 | console.log(randomIntArray); // Output: e.g., [42, 15, 73, 91, 5] 158 | 159 | 160 | 161 | // Select a random element from an array 162 | 163 | const randomElement = RandomizeX.Element(['apple', 'banana', 'orange']); 164 | 165 | console.log(randomElement); // Output: e.g., "banana" 166 | 167 | 168 | 169 | // Generate a random boolean value with a specific probability (e.g., 70%) 170 | 171 | const randomWithProbability = RandomizeX.BooleanWithProbability(0.7); 172 | 173 | console.log(randomWithProbability); // Output: e.g., true 174 | 175 | 176 | 177 | // Generate a custom string with a specified length and character set 178 | 179 | const customString = RandomizeX.String(10, 'abcdefghijklmnopqrstuvwxyz'); 180 | 181 | console.log(customString); // Output: e.g., "hjkldsfqwe" 182 | 183 | 184 | 185 | // Generate a random date within a specified date range 186 | 187 | const randomDateInRange = RandomizeX.DateInRange(new Date(2023, 1, 1), new Date(2023, 12, 31)); 188 | 189 | console.log(randomDateInRange); // Output: e.g., "Wed Jul 05 2023 07:25:13 GMT+0300 (East Africa Time)" 190 | 191 | 192 | 193 | // Generate a random time in HH:MM:SS format 194 | 195 | const randomTime = RandomizeX.Time(); 196 | 197 | console.log(randomTime); // Output: e.g., "15:23:47" 198 | 199 | 200 | 201 | // Generate a random filename with a specified extension 202 | 203 | const randomFilename = RandomizeX.FileName('txt'); 204 | 205 | console.log(randomFilename); // Output: e.g., "abcde12345.txt" 206 | 207 | 208 | 209 | // Generate a random hexadecimal color code with a leading # symbol 210 | 211 | const randomHexColor = RandomizeX.HexColor(); 212 | 213 | console.log(randomHexColor); // Output: e.g., "#1a2b3c" 214 | 215 | 216 | 217 | // Generate a random IPv6 address 218 | 219 | const randomIPv6Address = RandomizeX.IPv6Address(); 220 | 221 | console.log(randomIPv6Address); // Output: e.g., "2001:0db8:85a3:0000:0000:8a2e:0370:7334" 222 | 223 | 224 | 225 | // Generate a random MAC address 226 | 227 | const randomMACAddress = RandomizeX.MACAddress(); 228 | 229 | console.log(randomMACAddress); // Output: e.g., "fa:24:25:d4:95:71" 230 | 231 | 232 | 233 | // Generate a random GUID (Globally Unique Identifier) 234 | 235 | const randomGUID = RandomizeX.GUID(); 236 | 237 | console.log(randomGUID); // Output: e.g., "46d205e8-35a8-4fae-89c7-c33b3988a9f6" 238 | 239 | 240 | 241 | // Generate a random currency code 242 | 243 | const randomCurrency = RandomizeX.Currency(); 244 | 245 | console.log(randomCurrency); // Output: e.g., "USD" 246 | 247 | 248 | 249 | // Generate a random country name 250 | 251 | const randomCountry = RandomizeX.Country(); 252 | 253 | console.log(randomCountry); // Output: e.g., "France" 254 | 255 | 256 | 257 | // Generate a random city name 258 | 259 | const randomCity = RandomizeX.City(); 260 | 261 | console.log(randomCity); // Output: e.g., "Paris" 262 | 263 | 264 | 265 | // Generate a random street address 266 | 267 | const randomStreetAddress = RandomizeX.StreetAddress(); 268 | 269 | console.log(randomStreetAddress); // Output: e.g., "123 Main Street" 270 | 271 | 272 | 273 | // Generate a random postal code 274 | 275 | const randomPostalCode = RandomizeX.PostalCode(); 276 | 277 | console.log(randomPostalCode); // Output: e.g., "12345" 278 | 279 | 280 | 281 | // Generate a random latitude value between -90 and 90 282 | 283 | const randomLatitude = RandomizeX.Latitude(); 284 | 285 | console.log(randomLatitude); // Output: e.g., -12.345678 286 | 287 | 288 | 289 | // Generate a random longitude value between -180 and 180 290 | 291 | const randomLongitude = RandomizeX.Longitude(); 292 | 293 | console.log(randomLongitude); // Output: e.g., 45.678901 294 | 295 | 296 | 297 | // Generate a random HTTP method (e.g., GET, POST, PUT, etc.) 298 | 299 | const randomHttpMethod = RandomizeX.HttpMethod(); 300 | 301 | console.log(randomHttpMethod); // Output: e.g., "GET" 302 | 303 | 304 | 305 | // Generate a random MIME type (e.g., application/json, text/plain, etc.) 306 | 307 | const randomMimeType = RandomizeX.MimeType(); 308 | 309 | console.log(randomMimeType); // Output: e.g., "image/jpeg" 310 | 311 | 312 | ``` 313 | **100+ more methods...** 314 | 315 | 316 | 317 | 318 | ## Features 319 | 320 | 321 | - Generates random strings, numbers, dates, email addresses, phone numbers, IP addresses, URLs, colors, credit card numbers, booleans, arrays, and more. 322 | 323 | - Provides functions for custom string generation with specified lengths and character sets. 324 | 325 | - Offers the ability to generate random dates within a specified range. 326 | 327 | - Generates random times in HH:MM:SS format. 328 | 329 | - Creates random filenames with specified extensions. 330 | 331 | - Generates hexadecimal color codes with and without a leading # symbol. 332 | 333 | - Produces random IPv6 and MAC addresses. 334 | 335 | - Creates random GUIDs (Globally Unique Identifiers). 336 | 337 | - Provides random currency and country codes. 338 | 339 | - Generates random city and street address names. 340 | 341 | - Creates random postal codes. 342 | 343 | - Produces random latitude and longitude values. 344 | 345 | - Generates random HTTP methods. 346 | 347 | - Provides random MIME types. 348 | 349 | 350 | ## Contributing 351 | 352 | We welcome contributions to RandomizeX. If you have any suggestions or improvements, please feel free to create a pull request. 353 | 354 | ## License 355 | 356 | This library is licensed under the MIT License. For more information, please see the LICENSE file. 357 | 358 | ## About 359 | 360 | RandomizeX is developed and maintained by **Ali Asghar Gill**. It was created to provide a 361 | simple and versatile way to generate random data in JavaScript and JavaScript/TypeScript 362 | applications. 363 | 364 | If you have any questions, feedback, or suggestions, please don't hesitate to reach out to 365 | us at the following email. 366 | 367 | ```sh 368 | stylinalivlogs@gmail.com 369 | ``` 370 | 371 | Thank you for using RandomizeX! 372 | 373 | ``` -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | export class RandomizeX { 2 | static idSet: Set = new Set(); 3 | 4 | static Id(length: number = 16): string { 5 | const chars: string = 6 | "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()"; 7 | let result: string = ""; 8 | while (result.length < length) { 9 | const randomChar = chars.charAt(Math.floor(Math.random() * chars.length)); 10 | result += randomChar; 11 | } 12 | 13 | const id = parseInt(result, 36); 14 | if (RandomizeX.idSet.has(id)) { 15 | return RandomizeX.Id(length); 16 | } 17 | 18 | RandomizeX.idSet.add(id); 19 | 20 | let formattedResult = ""; 21 | for (let i = 0; i < result.length; i++) { 22 | if (i > 0 && i % 4 === 0) { 23 | formattedResult += "-"; 24 | } 25 | formattedResult += result[i]; 26 | } 27 | 28 | return formattedResult; 29 | } 30 | 31 | static Sentence(sentenceLength: number = 6): string { 32 | const words: string[] = [ 33 | "Lorem", 34 | "ipsum", 35 | "dolor", 36 | "sit", 37 | "amet", 38 | "consectetur", 39 | "adipiscing", 40 | "elit", 41 | "sed", 42 | "do", 43 | "eiusmod", 44 | "tempor", 45 | "incididunt", 46 | "ut", 47 | "labore", 48 | "et", 49 | "dolore", 50 | "magna", 51 | "aliqua", 52 | "gill", 53 | ]; 54 | 55 | let result: string = ""; 56 | for (let i = 0; i < sentenceLength; i++) { 57 | const randomIndex = Math.floor(Math.random() * words.length); 58 | result += words[randomIndex] + " "; 59 | } 60 | 61 | result = result.charAt(0).toUpperCase() + result.slice(1, -1) + "."; 62 | 63 | return result; 64 | } 65 | 66 | static Number(min: number = 0, max: number = 100): number { 67 | return Math.floor(Math.random() * (max - min + 1)) + min; 68 | } 69 | 70 | static Email(): string { 71 | const domains: string[] = [ 72 | "gmail.com", 73 | "yahoo.com", 74 | "hotmail.com", 75 | "example.com", 76 | ]; 77 | const domain: string = RandomizeX.Element(domains); 78 | const usernameLength: number = RandomizeX.Number(5, 10); // Random username length between 5 and 10 79 | let username: string = ""; 80 | const chars: string = "abcdefghijklmnopqrstuvwxyz0123456789"; 81 | for (let i = 0; i < usernameLength; i++) { 82 | username += chars.charAt(Math.floor(Math.random() * chars.length)); 83 | } 84 | return `${username}@${domain}`; 85 | } 86 | 87 | static Boolean(): boolean { 88 | return Math.random() < 0.5; 89 | } 90 | 91 | static Date( 92 | start: Date = new Date(2000, 0, 1), 93 | end: Date = new Date() 94 | ): Date { 95 | return new Date( 96 | start.getTime() + Math.random() * (end.getTime() - start.getTime()) 97 | ); 98 | } 99 | 100 | static PhoneNumber(): string { 101 | const countryCode: number = RandomizeX.Number(100, 999); // Random 3-digit country code 102 | const areaCode: number = RandomizeX.Number(100, 999); // Random 3-digit area code 103 | const subscriberNumber: number = RandomizeX.Number(1000, 9999); // Random 4-digit subscriber number 104 | return `+${countryCode}-${areaCode}-${subscriberNumber}`; 105 | } 106 | 107 | static IpAddress(): string { 108 | const octet = (): number => Math.floor(Math.random() * 256); 109 | return `${octet()}.${octet()}.${octet()}.${octet()}`; 110 | } 111 | 112 | static Url(): string { 113 | const protocols: string[] = ["http", "https"]; 114 | const protocol: string = RandomizeX.Element(protocols); 115 | const domain: string = RandomizeX.Sentence(1) 116 | .replace(".", "") 117 | .toLowerCase(); // Random domain name 118 | const pathLength: number = RandomizeX.Number(1, 10); // Random path length between 1 and 10 119 | let path: string = ""; 120 | for (let i = 0; i < pathLength; i++) { 121 | path += "/" + RandomizeX.Sentence(1).toLowerCase().replace(".", ""); 122 | } 123 | return `${protocol}://${domain}${path}`; 124 | } 125 | 126 | static Color(): string { 127 | const randomColor: string = Math.floor(Math.random() * 16777215).toString( 128 | 16 129 | ); // Generate random hexadecimal color code 130 | return `#${randomColor}`; 131 | } 132 | 133 | static CreditCardNumber(): string { 134 | const firstDigit: number = RandomizeX.Number(1, 9); // Random number between 1 and 9 for the first digit 135 | let ccNumber: string = `${firstDigit}`; 136 | for (let i = 0; i < 15; i++) { 137 | ccNumber += RandomizeX.Number(0, 9); // Random digits for the rest of the credit card number 138 | } 139 | return ccNumber; 140 | } 141 | 142 | static BooleanArray(length: number = 5): boolean[] { 143 | return Array.from({ length }, () => Math.random() < 0.5); 144 | } 145 | 146 | static IntArray( 147 | length: number = 5, 148 | min: number = 0, 149 | max: number = 100 150 | ): number[] { 151 | return Array.from({ length }, () => RandomizeX.Number(min, max)); 152 | } 153 | 154 | static Element(array: T[]): T { 155 | return array[Math.floor(Math.random() * array.length)]; 156 | } 157 | 158 | static BooleanWithProbability(probability: number): boolean { 159 | return Math.random() < probability; 160 | } 161 | 162 | static String( 163 | length: number = 10, 164 | chars: string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit." 165 | ): string { 166 | let result = ""; 167 | for (let i = 0; i < length; i++) { 168 | result += chars.charAt(Math.floor(Math.random() * chars.length)); 169 | } 170 | return result; 171 | } 172 | 173 | static DateInRange(startDate: Date, endDate: Date): Date { 174 | return new Date( 175 | startDate.getTime() + 176 | Math.random() * (endDate.getTime() - startDate.getTime()) 177 | ); 178 | } 179 | 180 | static Time(): string { 181 | const hours = RandomizeX.Number(0, 23); 182 | const minutes = RandomizeX.Number(0, 59); 183 | const seconds = RandomizeX.Number(0, 59); 184 | return `${hours.toString().padStart(2, "0")}:${minutes 185 | .toString() 186 | .padStart(2, "0")}:${seconds.toString().padStart(2, "0")}`; 187 | } 188 | 189 | static FileName(extension: string): string { 190 | return ( 191 | RandomizeX.String( 192 | 10, 193 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 194 | ) + 195 | "." + 196 | extension 197 | ); 198 | } 199 | 200 | static HexColor(): string { 201 | const randomColor: string = Math.floor(Math.random() * 16777215).toString( 202 | 16 203 | ); // Generate random hexadecimal color code 204 | return `#${randomColor.padStart(6, "0")}`; 205 | } 206 | 207 | static IPv6Address(): string { 208 | let address = ""; 209 | for (let i = 0; i < 8; i++) { 210 | address += Math.floor(Math.random() * 65535) 211 | .toString(16) 212 | .padStart(4, "0"); 213 | if (i < 7) { 214 | address += ":"; 215 | } 216 | } 217 | return address; 218 | } 219 | 220 | static MACAddress(): string { 221 | let address = ""; 222 | for (let i = 0; i < 6; i++) { 223 | address += Math.floor(Math.random() * 256) 224 | .toString(16) 225 | .padStart(2, "0"); 226 | if (i < 5) { 227 | address += ":"; 228 | } 229 | } 230 | return address; 231 | } 232 | 233 | static GUID(): string { 234 | return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( 235 | /[xy]/g, 236 | function (c) { 237 | const r = (Math.random() * 16) | 0; 238 | const v = c === "x" ? r : (r & 0x3) | 0x8; 239 | return v.toString(16); 240 | } 241 | ); 242 | } 243 | 244 | static Currency(): string { 245 | const currencies: string[] = [ 246 | "USD", 247 | "EUR", 248 | "GBP", 249 | "JPY", 250 | "AUD", 251 | "CAD", 252 | "CHF", 253 | "CNY", 254 | "SEK", 255 | "NZD", 256 | ]; 257 | return RandomizeX.Element(currencies); 258 | } 259 | 260 | static Country(): string { 261 | const countries: string[] = [ 262 | "USA", 263 | "Germany", 264 | "UK", 265 | "France", 266 | "Italy", 267 | "Japan", 268 | "China", 269 | "Canada", 270 | "Australia", 271 | "Brazil", 272 | ]; 273 | return RandomizeX.Element(countries); 274 | } 275 | 276 | static City(): string { 277 | const cities: string[] = [ 278 | "New York", 279 | "London", 280 | "Paris", 281 | "Tokyo", 282 | "Berlin", 283 | "Sydney", 284 | "Rome", 285 | "Madrid", 286 | "Toronto", 287 | "Moscow", 288 | ]; 289 | return RandomizeX.Element(cities); 290 | } 291 | 292 | static StreetAddress(): string { 293 | const streetNames: string[] = [ 294 | "Main Street", 295 | "High Street", 296 | "Park Avenue", 297 | "Broadway", 298 | "Sunset Boulevard", 299 | "Abbey Road", 300 | "Baker Street", 301 | ]; 302 | const streetNumber = RandomizeX.Number(1, 999); 303 | return `${streetNumber} ${RandomizeX.Element(streetNames)}`; 304 | } 305 | 306 | static PostalCode(): string { 307 | const postalCode = RandomizeX.Number(10000, 99999); 308 | return postalCode.toString(); 309 | } 310 | 311 | static Latitude(): number { 312 | return Math.random() * (90 - -90) + -90; 313 | } 314 | 315 | static Longitude(): number { 316 | return Math.random() * (180 - -180) + -180; 317 | } 318 | 319 | static HTTPMethod(): string { 320 | const methods: string[] = [ 321 | "GET", 322 | "POST", 323 | "PUT", 324 | "DELETE", 325 | "PATCH", 326 | "OPTIONS", 327 | "HEAD", 328 | ]; 329 | return RandomizeX.Element(methods); 330 | } 331 | 332 | static MimeType(): string { 333 | const mimeTypes: string[] = [ 334 | "application/json", 335 | "text/plain", 336 | "image/jpeg", 337 | "image/png", 338 | "application/pdf", 339 | "application/xml", 340 | "text/html", 341 | "text/css", 342 | "application/javascript", 343 | ]; 344 | return RandomizeX.Element(mimeTypes); 345 | } 346 | 347 | static RandomProduct(): { name: string; price: number; category: string } { 348 | const categories = [ 349 | "Electronics", 350 | "Clothing", 351 | "Home Decor", 352 | "Books", 353 | "Sports Equipment", 354 | "Beauty Products", 355 | "Toys", 356 | "Furniture", 357 | "Food and Beverages", 358 | "Fitness Gear", 359 | ]; 360 | const products = [ 361 | { name: "Smartphone", price: 500, category: "Electronics" }, 362 | { name: "Laptop", price: 1000, category: "Electronics" }, 363 | { name: "Headphones", price: 100, category: "Electronics" }, 364 | { name: "T-shirt", price: 20, category: "Clothing" }, 365 | { name: "Jeans", price: 50, category: "Clothing" }, 366 | { name: "Sneakers", price: 80, category: "Clothing" }, 367 | { name: "Wall Clock", price: 30, category: "Home Decor" }, 368 | { name: "Throw Pillow", price: 15, category: "Home Decor" }, 369 | { name: "Book", price: 10, category: "Books" }, 370 | { name: "Basketball", price: 25, category: "Sports Equipment" }, 371 | { name: "Yoga Mat", price: 30, category: "Fitness Gear" }, 372 | { name: "Lipstick", price: 15, category: "Beauty Products" }, 373 | { name: "Action Figure", price: 12, category: "Toys" }, 374 | { name: "Coffee Table", price: 150, category: "Furniture" }, 375 | { name: "Chocolate Bar", price: 5, category: "Food and Beverages" }, 376 | ]; 377 | 378 | const product = RandomizeX.RandomElement(products); 379 | return { 380 | name: product.name, 381 | price: product.price, 382 | category: product.category, 383 | }; 384 | } 385 | 386 | static RandomColorPalette(): string[] { 387 | const colors = [ 388 | "#FF6633", 389 | "#FFB399", 390 | "#FF33FF", 391 | "#FFFF99", 392 | "#00B3E6", 393 | "#E6B333", 394 | "#3366E6", 395 | "#999966", 396 | "#99FF99", 397 | "#B34D4D", 398 | "#80B300", 399 | "#809900", 400 | "#E6B3B3", 401 | "#6680B3", 402 | "#66991A", 403 | "#FF99E6", 404 | "#CCFF1A", 405 | "#FF1A66", 406 | "#E6331A", 407 | "#33FFCC", 408 | "#66994D", 409 | "#B366CC", 410 | "#4D8000", 411 | "#B33300", 412 | "#CC80CC", 413 | "#66664D", 414 | "#991AFF", 415 | "#E666FF", 416 | "#4DB3FF", 417 | "#1AB399", 418 | "#E666B3", 419 | "#33991A", 420 | "#CC9999", 421 | "#B3B31A", 422 | "#00E680", 423 | "#4D8066", 424 | "#809980", 425 | "#E6FF80", 426 | "#1AFF33", 427 | "#999933", 428 | "#FF3380", 429 | "#CCCC00", 430 | "#66E64D", 431 | "#4D80CC", 432 | "#9900B3", 433 | "#E64D66", 434 | "#4DB380", 435 | "#FF4D4D", 436 | "#99E6E6", 437 | "#6666FF", 438 | ]; 439 | 440 | const paletteLength = RandomizeX.Number(3, 6); // Random number of colors between 3 and 6 441 | 442 | const sampledColors: string[] = []; 443 | for (let i = 0; i < paletteLength; i++) { 444 | const randomIndex = RandomizeX.Number(0, colors.length - 1); 445 | sampledColors.push(colors[randomIndex]); 446 | colors.splice(randomIndex, 1); 447 | } 448 | 449 | return sampledColors; 450 | } 451 | 452 | static RandomCountryCurrency(): { country: string; currency: string } { 453 | const countries = [ 454 | "USA", 455 | "Germany", 456 | "UK", 457 | "France", 458 | "Italy", 459 | "Japan", 460 | "China", 461 | "Canada", 462 | "Australia", 463 | "Brazil", 464 | ]; 465 | const currencies = ["USD", "EUR", "GBP", "JPY", "AUD", "CAD", "CNY", "BRL"]; 466 | 467 | const country = RandomizeX.RandomElement(countries); 468 | const currency = currencies[countries.indexOf(country)]; 469 | return { country, currency }; 470 | } 471 | 472 | static RandomTimezone(): string { 473 | const timezones = [ 474 | "America/New_York", 475 | "America/Chicago", 476 | "America/Denver", 477 | "America/Los_Angeles", 478 | "Europe/London", 479 | "Europe/Paris", 480 | "Europe/Berlin", 481 | "Asia/Tokyo", 482 | "Asia/Shanghai", 483 | "Australia/Sydney", 484 | "Africa/Cairo", 485 | "Africa/Johannesburg", 486 | "Pacific/Honolulu", 487 | ]; 488 | return RandomizeX.RandomElement(timezones); 489 | } 490 | 491 | static RandomEmoji(): string { 492 | const emojis = [ 493 | "😀", 494 | "😃", 495 | "😄", 496 | "😁", 497 | "😆", 498 | "😅", 499 | "😂", 500 | "🤣", 501 | "😊", 502 | "😇", 503 | "🙂", 504 | "🙃", 505 | "😉", 506 | "😌", 507 | "😍", 508 | "🥰", 509 | "😘", 510 | "😗", 511 | "😙", 512 | "😚", 513 | "😋", 514 | "😛", 515 | "😜", 516 | "😝", 517 | "🤑", 518 | "🤗", 519 | "🤓", 520 | "😎", 521 | "🤡", 522 | "🥳", 523 | "🥸", 524 | "😏", 525 | "😒", 526 | "😞", 527 | "😔", 528 | "😟", 529 | "😕", 530 | "🙁", 531 | "😣", 532 | "😖", 533 | "😫", 534 | "😩", 535 | "🥺", 536 | "😢", 537 | "😭", 538 | "😤", 539 | "😠", 540 | "😡", 541 | "🤬", 542 | "🤯", 543 | "😳", 544 | "🥵", 545 | "🥶", 546 | "😱", 547 | "😨", 548 | "😰", 549 | "😥", 550 | "😓", 551 | "🤗", 552 | "🤔", 553 | "🤭", 554 | "🤫", 555 | "🤥", 556 | "😶", 557 | "😐", 558 | "😑", 559 | "😬", 560 | "🙄", 561 | "😯", 562 | "😦", 563 | "😧", 564 | "😮", 565 | "😲", 566 | "🥱", 567 | "😴", 568 | "🤤", 569 | "😪", 570 | "😵", 571 | "🤐", 572 | "🥴", 573 | "🤢", 574 | "🤮", 575 | "🤧", 576 | "😷", 577 | "🤒", 578 | "🤕", 579 | "🤑", 580 | "🤠", 581 | "👽", 582 | "👾", 583 | "🤖", 584 | "🎃", 585 | "😺", 586 | "😸", 587 | "😹", 588 | "😻", 589 | "😼", 590 | "😽", 591 | "🙀", 592 | "😿", 593 | "😾", 594 | ]; 595 | return RandomizeX.RandomElement(emojis); 596 | } 597 | 598 | static RandomUserAgent(): string { 599 | const browsers = [ 600 | "Chrome", 601 | "Firefox", 602 | "Safari", 603 | "Edge", 604 | "Internet Explorer", 605 | "Opera", 606 | "Brave", 607 | "Vivaldi", 608 | "UC Browser", 609 | "Samsung Internet", 610 | ]; 611 | const os = ["Windows", "Macintosh", "Linux", "Android", "iOS"]; 612 | const versions = ["11.0", "10.0", "7.0", "5.0", "6.0", "8.0", "9.0"]; 613 | 614 | const browser = RandomizeX.RandomElement(browsers); 615 | const platform = RandomizeX.RandomElement(os); 616 | const version = RandomizeX.RandomElement(versions); 617 | 618 | return `Mozilla/5.0 (${platform}) AppleWebKit/537.36 (KHTML, like Gecko) ${browser}/${version}`; 619 | } 620 | 621 | static RandomProgrammingLanguage(): string { 622 | const languages = [ 623 | "JavaScript", 624 | "Python", 625 | "Java", 626 | "C#", 627 | "C++", 628 | "PHP", 629 | "TypeScript", 630 | "Ruby", 631 | "Swift", 632 | "Kotlin", 633 | ]; 634 | return RandomizeX.RandomElement(languages); 635 | } 636 | 637 | static RandomFramework(): string { 638 | const frameworks = [ 639 | "React", 640 | "Angular", 641 | "Vue.js", 642 | "Express.js", 643 | "Django", 644 | "Spring Boot", 645 | "Ruby on Rails", 646 | "Flask", 647 | "Laravel", 648 | "Symfony", 649 | ]; 650 | return RandomizeX.RandomElement(frameworks); 651 | } 652 | 653 | static RandomDatabase(): string { 654 | const databases = [ 655 | "MySQL", 656 | "PostgreSQL", 657 | "MongoDB", 658 | "SQLite", 659 | "Oracle Database", 660 | "Microsoft SQL Server", 661 | "Redis", 662 | "Cassandra", 663 | "Firebase", 664 | "DynamoDB", 665 | ]; 666 | return RandomizeX.RandomElement(databases); 667 | } 668 | 669 | static RandomIDE(): string { 670 | const IDEs = [ 671 | "Visual Studio Code", 672 | "IntelliJ IDEA", 673 | "Eclipse", 674 | "PyCharm", 675 | "Atom", 676 | "Sublime Text", 677 | "NetBeans", 678 | "Android Studio", 679 | "Xcode", 680 | "Visual Studio", 681 | ]; 682 | return RandomizeX.RandomElement(IDEs); 683 | } 684 | 685 | static RandomVersionControlSystem(): string { 686 | const VCSs = [ 687 | "Git", 688 | "SVN", 689 | "Mercurial", 690 | "Perforce", 691 | "TFS", 692 | "CVS", 693 | "Bazaar", 694 | "Darcs", 695 | "Fossil", 696 | "Bitbucket", 697 | ]; 698 | return RandomizeX.RandomElement(VCSs); 699 | } 700 | 701 | static RandomDesignPattern(): string { 702 | const patterns = [ 703 | "Singleton", 704 | "Factory Method", 705 | "Observer", 706 | "Strategy", 707 | "Decorator", 708 | "Adapter", 709 | "Facade", 710 | "Composite", 711 | "Proxy", 712 | "Chain of Responsibility", 713 | ]; 714 | return RandomizeX.RandomElement(patterns); 715 | } 716 | 717 | static RandomHTTPStatusCode(): number { 718 | const statusCodes = [200, 201, 204, 400, 401, 403, 404, 500, 503]; 719 | return RandomizeX.RandomElement(statusCodes); 720 | } 721 | 722 | static RandomEncryptionAlgorithm(): string { 723 | const algorithms = [ 724 | "AES", 725 | "RSA", 726 | "DES", 727 | "Blowfish", 728 | "Twofish", 729 | "RC4", 730 | "3DES", 731 | "ECC", 732 | "SHA-256", 733 | "MD5", 734 | ]; 735 | return RandomizeX.RandomElement(algorithms); 736 | } 737 | 738 | static RandomOperatingSystem(): string { 739 | const operatingSystems = [ 740 | "Windows", 741 | "MacOS", 742 | "Linux", 743 | "iOS", 744 | "Android", 745 | "Ubuntu", 746 | "CentOS", 747 | "Fedora", 748 | "Debian", 749 | "Windows Server", 750 | ]; 751 | return RandomizeX.RandomElement(operatingSystems); 752 | } 753 | 754 | static RandomDevice(): string { 755 | const devices = [ 756 | "Desktop", 757 | "Laptop", 758 | "Smartphone", 759 | "Tablet", 760 | "Smartwatch", 761 | "Smart TV", 762 | "Router", 763 | "Gaming Console", 764 | "Virtual Reality Headset", 765 | "Smart Home Device", 766 | ]; 767 | return RandomizeX.RandomElement(devices); 768 | } 769 | 770 | static RandomBrowser(): string { 771 | const browsers = [ 772 | "Chrome", 773 | "Firefox", 774 | "Safari", 775 | "Edge", 776 | "Internet Explorer", 777 | "Opera", 778 | "Brave", 779 | "Vivaldi", 780 | "UC Browser", 781 | "Samsung Internet", 782 | ]; 783 | return RandomizeX.RandomElement(browsers); 784 | } 785 | 786 | static RandomStatusCodeGroup(): number { 787 | const groups = [200, 400, 500]; 788 | return RandomizeX.RandomElement(groups); 789 | } 790 | 791 | static RandomDatabaseType(): string { 792 | const types = [ 793 | "Relational", 794 | "NoSQL", 795 | "NewSQL", 796 | "In-memory", 797 | "Columnar", 798 | "Document-oriented", 799 | "Graph", 800 | ]; 801 | return RandomizeX.RandomElement(types); 802 | } 803 | 804 | static RandomHTTPMethod(): string { 805 | const methods = [ 806 | "GET", 807 | "POST", 808 | "PUT", 809 | "DELETE", 810 | "PATCH", 811 | "HEAD", 812 | "OPTIONS", 813 | ]; 814 | return RandomizeX.RandomElement(methods); 815 | } 816 | 817 | static RandomFileName(): string { 818 | const fileNames = [ 819 | "index", 820 | "app", 821 | "main", 822 | "config", 823 | "utils", 824 | "constants", 825 | "styles", 826 | "functions", 827 | "helpers", 828 | ]; 829 | return RandomizeX.RandomElement(fileNames); 830 | } 831 | 832 | static RandomFileExtension(): string { 833 | const extensions = [ 834 | "js", 835 | "ts", 836 | "jsx", 837 | "tsx", 838 | "css", 839 | "scss", 840 | "html", 841 | "json", 842 | "md", 843 | "txt", 844 | ]; 845 | return RandomizeX.RandomElement(extensions); 846 | } 847 | 848 | static RandomGitCommand(): string { 849 | const commands = [ 850 | "git add", 851 | "git commit", 852 | "git push", 853 | "git pull", 854 | "git clone", 855 | "git branch", 856 | "git checkout", 857 | "git merge", 858 | "git rebase", 859 | "git reset", 860 | ]; 861 | return RandomizeX.RandomElement(commands); 862 | } 863 | 864 | static RandomHTTPHeader(): string { 865 | const headers = [ 866 | "Content-Type", 867 | "Authorization", 868 | "User-Agent", 869 | "Accept-Language", 870 | "Cache-Control", 871 | "Cookie", 872 | "Referer", 873 | "Origin", 874 | "Accept-Encoding", 875 | "If-None-Match", 876 | ]; 877 | return RandomizeX.RandomElement(headers); 878 | } 879 | 880 | static RandomCloudProvider(): string { 881 | const providers = [ 882 | "AWS", 883 | "Azure", 884 | "Google Cloud", 885 | "IBM Cloud", 886 | "Alibaba Cloud", 887 | "Oracle Cloud", 888 | "DigitalOcean", 889 | "Heroku", 890 | "Cloudflare", 891 | "Linode", 892 | ]; 893 | return RandomizeX.RandomElement(providers); 894 | } 895 | 896 | static RandomContainerizationTechnology(): string { 897 | const technologies = [ 898 | "Docker", 899 | "Kubernetes", 900 | "OpenShift", 901 | "Mesos", 902 | "Rkt", 903 | "LXC", 904 | "Podman", 905 | "containerd", 906 | "CRI-O", 907 | "Docker Compose", 908 | ]; 909 | return RandomizeX.RandomElement(technologies); 910 | } 911 | 912 | static RandomCI_CDTool(): string { 913 | const tools = [ 914 | "Jenkins", 915 | "Travis CI", 916 | "CircleCI", 917 | "GitLab CI/CD", 918 | "GitHub Actions", 919 | "Bitbucket Pipelines", 920 | "Bamboo", 921 | "TeamCity", 922 | "Azure DevOps", 923 | "Drone", 924 | ]; 925 | return RandomizeX.RandomElement(tools); 926 | } 927 | 928 | static RandomFileNameWithExtension(): string { 929 | const extensions = [ 930 | "txt", 931 | "pdf", 932 | "doc", 933 | "docx", 934 | "xls", 935 | "xlsx", 936 | "ppt", 937 | "pptx", 938 | ]; 939 | return `${RandomizeX.RandomString( 940 | 10, 941 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 942 | )}.${RandomizeX.RandomElement(extensions)}`; 943 | } 944 | 945 | static RandomFilePath(depth: number = 3): string { 946 | const parts = []; 947 | for (let i = 0; i < depth; i++) { 948 | parts.push( 949 | RandomizeX.RandomString( 950 | 5, 951 | "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" 952 | ) 953 | ); 954 | } 955 | return parts.join("/"); 956 | } 957 | 958 | static RandomUser(): { firstName: string; lastName: string; email: string } { 959 | const firstNames = [ 960 | "John", 961 | "Jane", 962 | "Alice", 963 | "Bob", 964 | "Charlie", 965 | "David", 966 | "Eve", 967 | "Frank", 968 | "Grace", 969 | "Hannah", 970 | ]; 971 | const lastNames = [ 972 | "Doe", 973 | "Smith", 974 | "Johnson", 975 | "Brown", 976 | "Lee", 977 | "Garcia", 978 | "Martinez", 979 | "Clark", 980 | "Rodriguez", 981 | "Lewis", 982 | ]; 983 | const domains = ["gmail.com", "yahoo.com", "hotmail.com", "example.com"]; 984 | const firstName = RandomizeX.RandomElement(firstNames); 985 | const lastName = RandomizeX.RandomElement(lastNames); 986 | const domain = RandomizeX.RandomElement(domains); 987 | const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@${domain}`; 988 | return { firstName, lastName, email }; 989 | } 990 | 991 | static RandomAddress(): { 992 | street: string; 993 | city: string; 994 | country: string; 995 | postalCode: string; 996 | } { 997 | const streetNames = [ 998 | "Main Street", 999 | "High Street", 1000 | "Park Avenue", 1001 | "Broadway", 1002 | "Sunset Boulevard", 1003 | "Abbey Road", 1004 | "Baker Street", 1005 | ]; 1006 | const cities = [ 1007 | "New York", 1008 | "London", 1009 | "Paris", 1010 | "Tokyo", 1011 | "Berlin", 1012 | "Sydney", 1013 | "Rome", 1014 | "Madrid", 1015 | "Toronto", 1016 | "Moscow", 1017 | ]; 1018 | const countries = [ 1019 | "USA", 1020 | "Germany", 1021 | "UK", 1022 | "France", 1023 | "Italy", 1024 | "Japan", 1025 | "China", 1026 | "Canada", 1027 | "Australia", 1028 | "Brazil", 1029 | ]; 1030 | const streetNumber = RandomizeX.Number(1, 999); 1031 | const postalCode = RandomizeX.Number(10000, 99999); 1032 | return { 1033 | street: `${streetNumber} ${RandomizeX.RandomElement(streetNames)}`, 1034 | city: RandomizeX.RandomElement(cities), 1035 | country: RandomizeX.RandomElement(countries), 1036 | postalCode: postalCode.toString(), 1037 | }; 1038 | } 1039 | 1040 | static RandomJobTitle(): string { 1041 | const jobTitles = [ 1042 | "Software Engineer", 1043 | "Web Developer", 1044 | "Data Analyst", 1045 | "UX Designer", 1046 | "Product Manager", 1047 | "DevOps Engineer", 1048 | "QA Engineer", 1049 | "Technical Writer", 1050 | ]; 1051 | return RandomizeX.RandomElement(jobTitles); 1052 | } 1053 | 1054 | static RandomCompanyName(): string { 1055 | const companyNames = [ 1056 | "Acme Corporation", 1057 | "Tech Industries", 1058 | "Global Solutions Ltd.", 1059 | "Innovative Designs Inc.", 1060 | "CodeCrafters LLC", 1061 | "DataMasters", 1062 | "WebWizards", 1063 | ]; 1064 | return RandomizeX.RandomElement(companyNames); 1065 | } 1066 | 1067 | static RandomLoremIpsumParagraph(): string { 1068 | const loremIpsumParagraphs = [ 1069 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 1070 | "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", 1071 | "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", 1072 | "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", 1073 | "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 1074 | ]; 1075 | return RandomizeX.RandomElement(loremIpsumParagraphs); 1076 | } 1077 | 1078 | static RandomLoremIpsumSentences(numSentences: number): string { 1079 | const loremIpsumSentences = [ 1080 | "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", 1081 | "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", 1082 | "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", 1083 | "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.", 1084 | "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", 1085 | ]; 1086 | let result = ""; 1087 | for (let i = 0; i < numSentences; i++) { 1088 | result += RandomizeX.RandomElement(loremIpsumSentences) + " "; 1089 | } 1090 | return result.trim(); 1091 | } 1092 | static UUID(): string { 1093 | return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( 1094 | /[xy]/g, 1095 | function (c) { 1096 | const r = (Math.random() * 16) | 0; 1097 | const v = c === "x" ? r : (r & 0x3) | 0x8; 1098 | return v.toString(16); 1099 | } 1100 | ); 1101 | } 1102 | 1103 | static Shuffle(array: T[]): T[] { 1104 | const shuffledArray = [...array]; 1105 | for (let i = shuffledArray.length - 1; i > 0; i--) { 1106 | const j = Math.floor(Math.random() * (i + 1)); 1107 | [shuffledArray[i], shuffledArray[j]] = [ 1108 | shuffledArray[j], 1109 | shuffledArray[i], 1110 | ]; 1111 | } 1112 | return shuffledArray; 1113 | } 1114 | 1115 | static RandomElement(array: T[]): T { 1116 | return array[Math.floor(Math.random() * array.length)]; 1117 | } 1118 | 1119 | static RandomBooleanWithProbability(probability: number): boolean { 1120 | return Math.random() < probability; 1121 | } 1122 | 1123 | static RandomDateInRange( 1124 | startDate: Date = new Date(), 1125 | endDate: Date = new Date(new Date().setMonth(new Date().getMonth() + 1)) 1126 | ): Date { 1127 | return new Date( 1128 | startDate.getTime() + 1129 | Math.random() * (endDate.getTime() - startDate.getTime()) 1130 | ); 1131 | } 1132 | 1133 | static RandomString(length: number, chars: string): string { 1134 | let result = ""; 1135 | for (let i = 0; i < length; i++) { 1136 | result += chars.charAt(Math.floor(Math.random() * chars.length)); 1137 | } 1138 | return result; 1139 | } 1140 | 1141 | static RandomIPAddress(): string { 1142 | return `${RandomizeX.Number(1, 255)}.${RandomizeX.Number( 1143 | 0, 1144 | 255 1145 | )}.${RandomizeX.Number(0, 255)}.${RandomizeX.Number(1, 254)}`; 1146 | } 1147 | 1148 | static RandomIPv6Address(): string { 1149 | let address = ""; 1150 | for (let i = 0; i < 8; i++) { 1151 | address += Math.floor(Math.random() * 65535) 1152 | .toString(16) 1153 | .padStart(4, "0"); 1154 | if (i < 7) { 1155 | address += ":"; 1156 | } 1157 | } 1158 | return address; 1159 | } 1160 | 1161 | // New Data from here 1162 | 1163 | // Generate a random Temperature 1164 | static Temperature() { 1165 | return `${(Math.random() * 100).toFixed(1)}°C`; 1166 | } 1167 | 1168 | // Generate a random Domain Name 1169 | static DomainName() { 1170 | const domainWords = ["example", "test", "website", "domain", "random"]; 1171 | const domains = ["com", "net", "org", "io"]; 1172 | return `${this.Element(domainWords)}${this.Element( 1173 | domainWords 1174 | )}${this.Element(domains)}`; 1175 | } 1176 | 1177 | // Generate a random Rating 1178 | static Rating() { 1179 | return Math.floor(Math.random() * 5) + 1; 1180 | } 1181 | 1182 | // Generate a random Address 1183 | static Address() { 1184 | const cities = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix"]; 1185 | const states = ["NY", "CA", "IL", "TX", "AZ"]; 1186 | return `${ 1187 | Math.floor(Math.random() * 1000) + 1 1188 | } ${this.Street()}, ${this.Element(cities)}, ${this.Element( 1189 | states 1190 | )} ${this.ZipCode()}`; 1191 | } 1192 | 1193 | // Generate a random Buzzword 1194 | static Buzzword() { 1195 | const buzzwords = [ 1196 | "synergy", 1197 | "innovation", 1198 | "disrupt", 1199 | "leverage", 1200 | "optimize", 1201 | ]; 1202 | return this.Element(buzzwords); 1203 | } 1204 | 1205 | // Generate a random Company Name 1206 | static CompanyName() { 1207 | const companyWords = [ 1208 | "Tech", 1209 | "Global", 1210 | "Innovations", 1211 | "Solutions", 1212 | "Enterprises", 1213 | ]; 1214 | return `${this.Element(companyWords)} ${this.Element(companyWords)}`; 1215 | } 1216 | 1217 | // Generate a random Department 1218 | static Department() { 1219 | const departments = ["Sales", "Marketing", "Finance", "HR", "IT"]; 1220 | return this.Element(departments); 1221 | } 1222 | 1223 | // Generate a random Job Title 1224 | static JobTitle() { 1225 | const jobTitles = [ 1226 | "Manager", 1227 | "Director", 1228 | "Developer", 1229 | "Designer", 1230 | "Analyst", 1231 | ]; 1232 | return `${this.Element( 1233 | jobTitles 1234 | )} ${this.Department()} ${this.CompanySuffix()}`; 1235 | } 1236 | 1237 | // Generate a random State 1238 | static State() { 1239 | const states = ["New York", "California", "Texas", "Florida", "Illinois"]; 1240 | return this.Element(states); 1241 | } 1242 | 1243 | // Generate a random Street 1244 | static Street() { 1245 | const streets = [ 1246 | "Main St", 1247 | "Park Ave", 1248 | "Broadway", 1249 | "Sunset Blvd", 1250 | "Michigan Ave", 1251 | ]; 1252 | return `${Math.floor(Math.random() * 1000) + 1} ${this.Element(streets)}`; 1253 | } 1254 | 1255 | // Generate a random Zip Code 1256 | static ZipCode() { 1257 | return `${Math.floor(Math.random() * 90000) + 10000}`; 1258 | } 1259 | 1260 | // Generate a random Music Genre 1261 | static MusicGenre() { 1262 | const genres = ["Rock", "Pop", "Hip Hop", "Jazz", "Classical"]; 1263 | return this.Element(genres); 1264 | } 1265 | 1266 | // Generate a random TV Genre 1267 | static TvGenre() { 1268 | const genres = ["Drama", "Comedy", "Action", "Sci-Fi", "Documentary"]; 1269 | return this.Element(genres); 1270 | } 1271 | 1272 | // Generate a random Movie Genre 1273 | static MovieGenre() { 1274 | const genres = ["Action", "Adventure", "Comedy", "Drama", "Horror"]; 1275 | return this.Element(genres); 1276 | } 1277 | 1278 | // Generate a random Animal 1279 | static Animal() { 1280 | const animals = ["Dog", "Cat", "Lion", "Elephant", "Tiger"]; 1281 | return this.Element(animals); 1282 | } 1283 | 1284 | // Generate a random Color Name 1285 | static ColorName() { 1286 | const colors = ["Red", "Blue", "Green", "Yellow", "Purple"]; 1287 | return this.Element(colors); 1288 | } 1289 | 1290 | // Generate a random Fruit 1291 | static Fruit() { 1292 | const fruits = ["Apple", "Banana", "Orange", "Grape", "Watermelon"]; 1293 | return this.Element(fruits); 1294 | } 1295 | 1296 | // Generate a random Vegetable 1297 | static Vegetable() { 1298 | const vegetables = ["Carrot", "Broccoli", "Spinach", "Cucumber", "Potato"]; 1299 | return this.Element(vegetables); 1300 | } 1301 | 1302 | // Generate a random Measurement Unit 1303 | static MeasurementUnit() { 1304 | const units = ["cm", "m", "km", "mm", "inches"]; 1305 | return this.Element(units); 1306 | } 1307 | 1308 | // Generate a random Currency Code 1309 | static CurrencyCode() { 1310 | const codes = ["USD", "EUR", "GBP", "JPY", "CNY"]; 1311 | return this.Element(codes); 1312 | } 1313 | 1314 | // Generate a random Country Code 1315 | static CountryCode() { 1316 | const codes = ["US", "CA", "UK", "DE", "FR"]; 1317 | return this.Element(codes); 1318 | } 1319 | 1320 | // Generate a random Profession 1321 | static Profession() { 1322 | const professions = ["Doctor", "Engineer", "Teacher", "Artist", "Chef"]; 1323 | return this.Element(professions); 1324 | } 1325 | 1326 | // Generate a random Wikipedia Link 1327 | static WikipediaLink() { 1328 | return `https://en.wikipedia.org/wiki/${this.String(10)}`; 1329 | } 1330 | 1331 | // Generate a random BS (Business Speak) phrase 1332 | static BS() { 1333 | const phrases = [ 1334 | "Synergize scalable metrics", 1335 | "Empower enterprise paradigms", 1336 | "Incentivize impactful e-commerce", 1337 | ]; 1338 | return this.Element(phrases); 1339 | } 1340 | 1341 | // Generate a random Catch Phrase 1342 | static CatchPhrase() { 1343 | const phrases = ["Just do it", "Think different", "I’m lovin’ it"]; 1344 | return this.Element(phrases); 1345 | } 1346 | 1347 | // Generate a random Company Suffix 1348 | static CompanySuffix() { 1349 | const suffixes = ["Inc", "LLC", "Corp", "Ltd", "Group"]; 1350 | return this.Element(suffixes); 1351 | } 1352 | 1353 | // Generate a random Database 1354 | static Database() { 1355 | const databases = ["MySQL", "PostgreSQL", "MongoDB", "SQLite", "Redis"]; 1356 | return this.Element(databases); 1357 | } 1358 | 1359 | // Generate a random Domain Suffix 1360 | static DomainSuffix() { 1361 | const suffixes = ["com", "net", "org", "io", "co"]; 1362 | return this.Element(suffixes); 1363 | } 1364 | 1365 | // Generate a random Hacker Phrase 1366 | static HackerPhrase() { 1367 | const phrases = [ 1368 | "Hack the planet", 1369 | "All your base are belong to us", 1370 | "There is no place like 127.0.0.1", 1371 | ]; 1372 | return this.Element(phrases); 1373 | } 1374 | 1375 | // Generate a random Market 1376 | static Market() { 1377 | const markets = [ 1378 | "Stock Market", 1379 | "Real Estate Market", 1380 | "Technology Market", 1381 | "Art Market", 1382 | "Cryptocurrency Market", 1383 | ]; 1384 | return this.Element(markets); 1385 | } 1386 | 1387 | // Generate a random Product Name 1388 | static ProductName() { 1389 | const products = [ 1390 | "iPhone", 1391 | "PlayStation", 1392 | "Tesla Model S", 1393 | "Nike Air Max", 1394 | "Starbucks Coffee", 1395 | ]; 1396 | return this.Element(products); 1397 | } 1398 | 1399 | // Generate a random Software Name 1400 | static Software() { 1401 | const softwares = [ 1402 | "Photoshop", 1403 | "Visual Studio Code", 1404 | "Google Chrome", 1405 | "Microsoft Word", 1406 | "Slack", 1407 | ]; 1408 | return this.Element(softwares); 1409 | } 1410 | 1411 | // Generate a random Weather 1412 | static Weather() { 1413 | const weather = ["Sunny", "Cloudy", "Rainy", "Snowy", "Windy"]; 1414 | return this.Element(weather); 1415 | } 1416 | 1417 | // Generate a random Word 1418 | static Word() { 1419 | const words = ["apple", "banana", "cherry", "dog", "elephant", "Gill"]; 1420 | return this.Element(words); 1421 | } 1422 | 1423 | // Generate a random Money value 1424 | static Money() { 1425 | return Math.floor(Math.random() * 1000); 1426 | } 1427 | 1428 | // Generate a random Card Type 1429 | static CardType() { 1430 | const types = ["Visa", "Mastercard", "American Express", "Discover"]; 1431 | return this.Element(types); 1432 | } 1433 | 1434 | // Generate a random Credit Card Expiry Date 1435 | static CreditCardExpiryDate() { 1436 | const year = new Date().getFullYear() + Math.floor(Math.random() * 5); 1437 | const month = Math.floor(Math.random() * 12) + 1; 1438 | return `${month}/${year}`; 1439 | } 1440 | 1441 | // Generate a random Credit Card CVV 1442 | static CreditCardCVV() { 1443 | return Math.floor(100 + Math.random() * 900); 1444 | } 1445 | 1446 | // Generate a random Color Hex 1447 | static ColorHex() { 1448 | return `#${Math.floor(Math.random() * 16777215) 1449 | .toString(16) 1450 | .padStart(6, "0")}`; 1451 | } 1452 | 1453 | // Generate a random RGB Color 1454 | static RGBColor() { 1455 | const r = Math.floor(Math.random() * 256); 1456 | const g = Math.floor(Math.random() * 256); 1457 | const b = Math.floor(Math.random() * 256); 1458 | return `rgb(${r}, ${g}, ${b})`; 1459 | } 1460 | 1461 | // Generate a random HSL Color 1462 | static HSLColor() { 1463 | const h = Math.floor(Math.random() * 360); 1464 | const s = Math.floor(Math.random() * 101); 1465 | const l = Math.floor(Math.random() * 101); 1466 | return `hsl(${h}, ${s}%, ${l}%)`; 1467 | } 1468 | 1469 | static IPv4() { 1470 | return `${Math.floor(Math.random() * 256)}.${Math.floor( 1471 | Math.random() * 256 1472 | )}.${Math.floor(Math.random() * 256)}.${Math.floor(Math.random() * 256)}`; 1473 | } 1474 | 1475 | // Generate a random URL Path 1476 | static URLPath() { 1477 | const paths = ["about", "blog", "contact", "products", "services"]; 1478 | return `/${this.Element(paths)}`; 1479 | } 1480 | 1481 | // Generate a random URL Query Parameter 1482 | static URLQueryParam() { 1483 | const keys = ["id", "page", "search", "category", "sort"]; 1484 | const key = this.Element(keys); 1485 | const value = this.String(5); 1486 | return `${key}=${value}`; 1487 | } 1488 | 1489 | // Generate a random URL Fragment 1490 | static URLFragment() { 1491 | return `#${this.String(5)}`; 1492 | } 1493 | 1494 | // Generate Lorem Ipsum text 1495 | static LoremIpsum() { 1496 | return "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; 1497 | } 1498 | 1499 | // Generate a random paragraph 1500 | static Paragraph() { 1501 | return `${this.Sentence()} ${this.Sentence()} ${this.Sentence()}`; 1502 | } 1503 | 1504 | // Generate a random Lorem Ipsum word 1505 | static LoremWord() { 1506 | const words = ["Lorem", "ipsum", "dolor", "sit", "amet"]; 1507 | return this.Element(words); 1508 | } 1509 | 1510 | // Generate a random Rick and Morty quote 1511 | static RickAndMortyQuote() { 1512 | const quotes = [ 1513 | "Wubba lubba dub dub!", 1514 | "I turned myself into a pickle, Morty!", 1515 | "Nobody exists on purpose. Nobody belongs anywhere. Everybody’s gonna die. Come watch TV.", 1516 | ]; 1517 | return this.Element(quotes); 1518 | } 1519 | 1520 | // Generate a random Harry Potter spell 1521 | static HarryPotterSpell() { 1522 | const spells = [ 1523 | "Expecto Patronum", 1524 | "Avada Kedavra", 1525 | "Wingardium Leviosa", 1526 | "Expelliarmus", 1527 | "Lumos", 1528 | ]; 1529 | return this.Element(spells); 1530 | } 1531 | 1532 | // Generate a random Dungeons and Dragons quote 1533 | static DungeonsAndDragonsQuote() { 1534 | const quotes = [ 1535 | "Roll for initiative!", 1536 | "I cast magic missile at the darkness!", 1537 | "You find a chest. What do you do?", 1538 | ]; 1539 | return this.Element(quotes); 1540 | } 1541 | 1542 | // Generate a random Star Wars quote 1543 | static StarWarsQuote() { 1544 | const quotes = [ 1545 | "May the Force be with you.", 1546 | "I am your father.", 1547 | "It’s a trap!", 1548 | ]; 1549 | return this.Element(quotes); 1550 | } 1551 | 1552 | // Generate a random Dice Roll 1553 | static DiceRoll() { 1554 | const sides = [4, 6, 8, 10, 12, 20]; 1555 | const side = this.Element(sides); 1556 | return `d${side}: ${Math.floor(Math.random() * side) + 1}`; 1557 | } 1558 | 1559 | // Generate a random Fact 1560 | static Fact() { 1561 | const facts = [ 1562 | "The Earth is the only planet not named after a god.", 1563 | "Bananas are berries, but strawberries are not.", 1564 | "The human brain takes in 11 million bits of information every second but is aware only of 40.", 1565 | "The Great Wall of China is not visible from space without aid.", 1566 | ]; 1567 | return this.Element(facts); 1568 | } 1569 | 1570 | // Generate a random Gender 1571 | static Gender() { 1572 | const genders = ["Male", "Female", "Other"]; 1573 | return this.Element(genders); 1574 | } 1575 | 1576 | static Username(): string { 1577 | const adjectives = [ 1578 | "happy", 1579 | "sleepy", 1580 | "grumpy", 1581 | "sneezy", 1582 | "dopey", 1583 | "bashful", 1584 | "doc", 1585 | "smiley", 1586 | "sunny", 1587 | "breezy", 1588 | ]; 1589 | const nouns = [ 1590 | "apple", 1591 | "banana", 1592 | "cherry", 1593 | "grape", 1594 | "kiwi", 1595 | "lemon", 1596 | "orange", 1597 | "pear", 1598 | "strawberry", 1599 | "watermelon", 1600 | ]; 1601 | 1602 | const randomAdjective = 1603 | adjectives[Math.floor(Math.random() * adjectives.length)]; 1604 | const randomNoun = nouns[Math.floor(Math.random() * nouns.length)]; 1605 | 1606 | const randomNumber = Math.floor(Math.random() * 100); 1607 | 1608 | return `${randomAdjective}-${randomNoun}-${randomNumber}`; 1609 | } 1610 | 1611 | // New End here 1612 | } 1613 | --------------------------------------------------------------------------------