randword Package¶
randword Package¶
The Python module for generating random English words.
rand_word Module¶
- randword.rand_word.word(count: int | None = None, include_pos: List[str] | None = None, exclude_pos: List[str] | None = None, word_len: int | None = None, min_word_len: int = 1, max_word_len: int | None = None, starts_with: str | None = None, ends_with: str | None = None, pattern: str | None = None) str | List[str][source]¶
Returns a random English word or a list of words
Abbreviation “pos” means “part of speech”
- Parameters:
count (int, optional) – The number of words to be generated. Defaults to None.
include_pos (list of str, optional) – List of parts of speech that will be included in the generation. Defaults to None
exclude_pos (list of str, optional) – List of parts of speech that will be excluded in the generation. Defaults to None
word_len (int, optional) – Specifies the length of a word. Ignores the min_word_len and max_word_len parameters. Defaults to None
min_word_len (int, optional) – The minimum word length. Defaults to 1
max_word_len (int, optional) – The maximum word length. Defaults to None
starts_with (str, optional) – The pattern with which the word begins. Defaults to None
ends_with (str, optional) – The pattern with which the word ends. Defaults to None
pattern (str, optional) – The pattern that should be contained in the word. Defaults to None
- Returns:
A random English word if count is None or a list of them if count is not None
- Return type:
Union[str, List[str]]
- Raises:
IndexError – If the word was not found or if the desired number of words was not found
rand_name Module¶
- randword.rand_name.fullname(count: int | None = None, gender: str | None = None) str | List[str][source]¶
Returns a random fullname or a list of them
- Parameters:
count (int, optional) – The number of fullnames to be generated. Defaults to None
gender (str) – Specifies the fullname of which gender will be generated. Defaults to None
- Returns:
A random fullname if count is None or a list of random fullnames if count is not None
- Return type:
Union[str, List[str]]
- randword.rand_name.name(count: int | None = None, gender: str | None = None) str | List[str][source]¶
Returns a random first name or a list of them
- Parameters:
count (int, optional) – The number of names to be generated. Defaults to None
gender (str, optional) – Specifies the name of which gender will be generated. Defaults to None
- Returns:
A random first name if count is None or a list of random first names if count is not None
- Return type:
Union[str, List[str]]
- randword.rand_name.surname(count: int | None = None) str | List[str][source]¶
Returns a random surname or a list of them
- Parameters:
count (int, optional) – The number of surnames to be generated. Defaults to None
- Returns:
A random surname if count is None or a list of surnames if count is not None
- Return type:
Union[str, List[str]]
rand_place Module¶
- randword.rand_place.city(count: int | None = None) str | List[str][source]¶
Returns a random city or a list of them
- Parameters:
count (int, optional) – The number of cities to be generated. Defaults to None
- Returns:
A random city if count is None or a list of cities if count is not None
- Return type:
Union[str, List[str]]
- randword.rand_place.country(count: int | None = None) str | List[str][source]¶
Returns a random country or a list of a random countries
- Parameters:
count (int, optional) – The number of countries to be generated. Defaults to None
- Returns:
A random country if count is None or a list of countries if count is not None
- Return type:
Union[str, List[str]]
rand_letter Module¶
- randword.rand_letter.digit(count: int | None = None) str | List[str][source]¶
Returns a random digit
- Parameters:
count (int, optional) – The number of digits to be generated. Defaults to None
- Returns:
A single digit if count is None or a list of digits if count is not None
- Return type:
Union[str, List[str]]
- randword.rand_letter.letter(count: int | None = None) str | List[str][source]¶
Returns a random ASCII letter or a list of them
- Parameters:
count (int, optional) – The number of letters to be generated. Defaults to None
- Returns:
An ASCII letter if count is None or a list of letters if count is not None
- Return type:
Union[str, List[str]]
- randword.rand_letter.sequence(count: int | None = None, length: int = 8) str | List[str][source]¶
Returns a random sequence consisting of ASCII symbols and digits or a list of a random sequences
- Parameters:
count (int, optional) – The number of sequances to be generated. Defaults to None
length (int, optional) – The length of the sequence. Defaults to 8
- Returns:
The sequence if count is None or a list of sequences if count is not None
- Return type:
Union[str, List[str]]
rand_other Module¶
- randword.rand_other.getrandbits(k) x. Generates an int with k random bits.¶
- randword.rand_other.random() x in the interval [0, 1).¶