randCity
The divisions a region is made of: a Korean 시·군·구, or a US city, town, village or census designated place.
randLocation with level fixed to 'city'LocationLevel.city"city", handing back the division's name alone rather than the whole location.
javascript
import { randCity } from 'randino';
randCity({ language: 'ko', count: 3 }); // ['함안군', '영덕군', '여수시']
randCity({ language: 'en', count: 3 }); // ['Donora', 'Blue Ridge', 'Chesilhurst']
randCity({ language: 'ko', output: 'detail' });
// [{ location: '중랑구', language: 'ko', level: 'city',
// country: '대한민국', region: '서울특별시', city: '중랑구', district: null }]dart
import 'package:randino/randino.dart';
randCity(language: LocationLanguage.ko, count: 3); // [함안군, 영덕군, 여수시]
randCity(language: LocationLanguage.en, count: 3); // [Donora, Blue Ridge, Chesilhurst]The detail form is randCityDetails.
python
from randino import rand_city
rand_city(language="ko", count=3) # ['함안군', '영덕군', '여수시']
rand_city(language="en", count=3) # ['Donora', 'Blue Ridge', 'Chesilhurst']A Korean 구 that is one of a city's districts rather than a local government of its own is written with its city, the way an address writes it: 수원시 장안구, not 장안구. 세종특별자치시 has no 시·군·구 at all, so it never comes back from here.
The same name can come back from different regions — Korea has a 중구 in five of them and twenty-eight US states have a Franklin — and unique compares the names, not the places. The detail output says which region each one is in.
javascript
randCity({ language: 'ko', startsWith: '수', count: 3 }); // ['수영구', '수성구', '수원시 장안구']
randCity({ language: 'en', maxLength: 5, count: 3 }); // ['Loco', 'Bruin', 'Keota']dart
randCity(language: LocationLanguage.ko, startsWith: '수', count: 3); // [수영구, 수성구, 수원시 장안구]python
rand_city(language="ko", starts_with="수", count=3) # ['수영구', '수성구', '수원시 장안구']Options
| Option | Type | Default | Description |
|---|---|---|---|
language | LocationLanguageOptionLocationLanguage?LocationLanguageOption | 'all'null"all" | Which language, and so which country, the places are from. Left out, it picks one per result and mixes them. |
count | numberintint | 1 | How many results to return. Clamped to 0 … 10000. |
minLengthminLengthmin_length | numberint?int | None | no bound | Minimum length in characters, of the whole string returned. |
maxLengthmaxLengthmax_length | numberint?int | None | no bound | Maximum length in characters. A range nothing fits is answered with the closest length there is. |
startsWithstartsWithstarts_with | stringString?str | —null"" | Keep only results whose first character is this one. |
unique | booleanboolbool | falsefalseFalse | Never return the same result twice. Returns fewer than asked once the list runs out. |
random | () => numberRandom?Callable[[], float] | None | —nullNone | Where the randomness comes from. Defaults to the platform's ordinary generator. |
output | RandOutputRandOutput | 'value'"value" | Strings, or one LocationDetail per result. |
See also
randLocation— the city with the region and country above it.randDistrict— the level below the city, which only Korea has.