@@ -177,6 +177,9 @@ class RandomService internal constructor(private val config: FakerConfig) {
177
177
* Default: `24`
178
178
* @param locale locale to use to generate the charset.
179
179
* Defaults to `locale` config value set for the `faker` instance.
180
+ * @param indexChars add additional index chars to the resulting string, as defined in
181
+ * [Character_Elements](https://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements).
182
+ * Default: `true`
180
183
* @param auxiliaryChars add additional auxiliary chars to the resulting string as defined in
181
184
* [Character_Elements](https://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements).
182
185
* Default: `false`
@@ -193,10 +196,6 @@ class RandomService internal constructor(private val config: FakerConfig) {
193
196
numericalChars : Boolean = false,
194
197
): String {
195
198
if (length < 1 ) return " " // base case
196
- if (locale in listOf (Locale .ENGLISH , Locale .US , Locale .UK , Locale .CANADA )) return randomString(
197
- length,
198
- numericalChars
199
- )
200
199
201
200
val localeData = LocaleData .getInstance(ULocale .forLocale(locale))
202
201
val mainChars = localeData.getExemplarSet(UnicodeSet .MIN_VALUE , LocaleData .ES_STANDARD )
@@ -222,6 +221,25 @@ class RandomService internal constructor(private val config: FakerConfig) {
222
221
return List (length) { chars.random(random.asKotlinRandom()) }.joinToString(" " )
223
222
}
224
223
224
+ /* *
225
+ * Returns [String] with a randomLength withing the specified [min] and [max] boundaries
226
+ * (or an empty string for if `randomLength < 1`)
227
+ * consisting of pseudo-randomly generated characters
228
+ * in a given [locale] with optional [auxiliaryChars] and [numericalChars]
229
+ *
230
+ * @param min the minimum length of the resulting string.
231
+ * @param max the maximum length of the resulting string.
232
+ * @param locale locale to use to generate the charset.
233
+ * Defaults to `locale` config value set for the `faker` instance.
234
+ * @param indexChars add additional index chars to the resulting string, as defined in
235
+ * [Character_Elements](https://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements).
236
+ * Default: `true`
237
+ * @param auxiliaryChars add additional auxiliary chars to the resulting string as defined in
238
+ * [Character_Elements](https://www.unicode.org/reports/tr35/tr35-general.html#Character_Elements).
239
+ * Default: `false`
240
+ * @param numericalChars add additional numerical chars from 0 to 9 to the resulting string
241
+ * Default: `false`
242
+ */
225
243
@JvmOverloads
226
244
fun randomString (
227
245
min : Int ,
0 commit comments