├── src └── cosFaker │ ├── JSON.cls │ ├── SQL.cls │ ├── UFC.cls │ ├── Coffee.cls │ ├── Pokemon.cls │ ├── Internet.cls │ ├── lib │ └── core.cls │ ├── Dates.cls │ ├── Color.cls │ ├── Phone.cls │ ├── Company.cls │ ├── Job.cls │ ├── App.cls │ ├── Game.cls │ ├── Name.cls │ ├── DragonBall.cls │ ├── Person.cls │ ├── Finance.cls │ ├── Address.cls │ ├── File.cls │ ├── Commerce.cls │ ├── StarWars.cls │ └── Lorem.cls ├── LICENSE └── README.md /src/cosFaker/JSON.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/JSON.cls -------------------------------------------------------------------------------- /src/cosFaker/SQL.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/SQL.cls -------------------------------------------------------------------------------- /src/cosFaker/UFC.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/UFC.cls -------------------------------------------------------------------------------- /src/cosFaker/Coffee.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/Coffee.cls -------------------------------------------------------------------------------- /src/cosFaker/Pokemon.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/Pokemon.cls -------------------------------------------------------------------------------- /src/cosFaker/Internet.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/Internet.cls -------------------------------------------------------------------------------- /src/cosFaker/lib/core.cls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/intersystems-community/cosfaker/master/src/cosFaker/lib/core.cls -------------------------------------------------------------------------------- /src/cosFaker/Dates.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Dates Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Forward(pDays As %Integer = 365, pFormat As %Integer = 3) 5 | { 6 | Quit $ZDateTime(($Horolog + $Random(pDays) +1),pFormat) 7 | } 8 | 9 | ClassMethod Backward(pDays As %Integer = 365, pFormat As %Integer = 3) 10 | { 11 | Quit $ZDateTime((($Horolog - $Random(pDays)) +1),pFormat) 12 | } 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /src/cosFaker/Color.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Color Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Hexadecimal() As %String 5 | { 6 | Quit "#"_$ZConvert(..Times(6,"cosFaker.lib.core","Hexadecimal"),"U") 7 | } 8 | 9 | ClassMethod RGB() As %String 10 | { 11 | Quit ..MaskNumber("#",0,255)_","_..MaskNumber("#",0,255)_","_..MaskNumber("#",0,255) 12 | } 13 | 14 | ClassMethod Name() As %String 15 | { 16 | Quit ..SampleFromFile("names") 17 | } 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /src/cosFaker/Phone.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Phone Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod PhoneNumber(pArea As %Boolean = 1) As %String 5 | { 6 | Set area = "" 7 | Set:pArea area = "("_..AreaCode()_") " 8 | 9 | Quit area_..MaskNumber("####-####") 10 | } 11 | 12 | ClassMethod CellPhone(pArea As %Boolean = 1) As %String 13 | { 14 | Set area = "" 15 | Set:pArea area = "("_..AreaCode()_") " 16 | 17 | Quit area_..MaskNumber("9####-####") 18 | } 19 | 20 | ClassMethod AreaCode() As %String 21 | { 22 | Quit ..MaskNumber("##",1,9) 23 | } 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/cosFaker/Company.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Company Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Name() As %String 5 | { 6 | Quit $Case($Random(2), 7 | 1:##class(Name).FirstName()_" "_..SampleFromFile("suffix"), 8 | :##class(Name).LastName()_" "_..SampleFromFile("suffix")) 9 | } 10 | 11 | ClassMethod Profession() As %String 12 | { 13 | Set prof = $ZConvert(..SampleFromFile("profession"),"l") 14 | Quit $ZConvert($Extract(prof,1,1),"U")_$Extract(prof,2,*) 15 | } 16 | 17 | ClassMethod Industry() As %String 18 | { 19 | Quit ..SampleFromFile("industry") 20 | } 21 | 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/cosFaker/Job.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Job Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Title() 5 | { 6 | Set title = $Random(3), 7 | seniority = ..SampleFromFile("title_seniority"), 8 | position = ..SampleFromFile("title_position") 9 | Quit:title=0 position_" "_..SampleFromFile("separator")_" "_..Field()_" "_seniority 10 | Quit:title=1 position_" "_seniority 11 | Quit:title=2 position_" "_..SampleFromFile("separator")_" "_..Field() 12 | } 13 | 14 | ClassMethod Field() 15 | { 16 | Quit ..SampleFromFile("field") 17 | } 18 | 19 | ClassMethod Skills() 20 | { 21 | Quit ..SampleFromFile("skills") 22 | } 23 | 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/cosFaker/App.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.App Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod FunctionName(pGroup = "", pSeparator As %String = "") As %String 5 | { 6 | Set:pSeparator="" pSeparator = " " 7 | Set action = ..AppAction() 8 | Set function = ..AppType() 9 | Quit action _ pSeparator _ function 10 | } 11 | 12 | ClassMethod AppAction(pGroup = "") As %String 13 | { 14 | Set:pGroup="" pGroup = $ListGet($ListFromString("SQL,IF,FUN",","),$Random(3)+1) 15 | Quit:pGroup="SQL" ..SampleFromFile("action_sql") 16 | Quit:pGroup="IF" ..SampleFromFile("action_if") 17 | Quit:pGroup="FUN" ..SampleFromFile("action_fun") 18 | Quit "" 19 | } 20 | 21 | ClassMethod AppType() As %String 22 | { 23 | Quit ..SampleFromFile("type") 24 | } 25 | 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/cosFaker/Game.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Game Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod MortalKombat() As %String 5 | { 6 | Set characters = $ListBuild("Liu Kang","Scorpion","Raiden","Johnny Cage","Sub-Zero","Sonya Blade","Kano","Reptile","Goro","Jax","Kitana","Kung Lao","Mileena","Nightwolf") 7 | Quit ..Sample(characters) 8 | } 9 | 10 | ClassMethod StreetFighter() As %String 11 | { 12 | Set characters = $ListBuild("Ryu","Ken","Retsu","Geki","Joe","Mike","Lee","Gen","Birdie","Eagle","Adon","Sagat","Chun-Li","Blanka","Zangief","EHonda","Guile","Dhalsim","Balrog","Vega","MBison","THawk","Cammy","FeiLong","DeeJay","Akuma") 13 | Quit ..Sample(characters) 14 | } 15 | 16 | ClassMethod Card(pAbrev As %Boolean = 0) As %String 17 | { 18 | Set cards = $ListBuild("A","2","3","4","5","6","7","8","9","J","Q","K") 19 | Quit:pAbrev ..Sample(cards)_$Extract(..SampleFromFile("suit"),1,1) 20 | Quit ..Sample(cards)_" "_..SampleFromFile("separator")_" "_..SampleFromFile("suit") 21 | } 22 | 23 | } 24 | 25 | -------------------------------------------------------------------------------- /src/cosFaker/Name.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Name Extends cosFaker.lib.core 2 | { 3 | 4 | /// Generate a First Name 5 | /// Female Gender = 1 6 | /// Male Gender = 2 7 | ClassMethod FirstName(pGender As %Integer = "") As %String 8 | { 9 | Set:pGender="" pGender = ($Random(2) + 1) 10 | Quit:pGender=2 ..SampleFromFile("male_names") 11 | Quit ..SampleFromFile("female_names") 12 | } 13 | 14 | ClassMethod LastName() As %String 15 | { 16 | Quit ..SampleFromFile("last_names") 17 | } 18 | 19 | ClassMethod FullName(pGender As %Integer = "") As %String 20 | { 21 | Set:pGender="" pGender = ($Random(2) + 1) 22 | 23 | If pGender = 2 { 24 | Set firstname = ..SampleFromFile("male_names") 25 | } Else { 26 | Set firstname = ..SampleFromFile("female_names") 27 | } 28 | 29 | Set rand = $Random(3) + 1,lastname = "" 30 | For k=1:1:rand { 31 | Set:k>1 lastname = lastname _ " " 32 | Set lastname = lastname _ ..SampleFromFile("last_names") 33 | } 34 | 35 | Quit firstname _ " " _ lastname 36 | } 37 | 38 | ClassMethod Suffix() As %String 39 | { 40 | Quit ..SampleFromFile("person_suffix") 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Henry "HammZ" Hamon 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 | -------------------------------------------------------------------------------- /src/cosFaker/DragonBall.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.DragonBall Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Character() As %String 5 | { 6 | Set characters = $ListBuild("Goku", "Bulma", "Kami", "Yamcha", "Krillin", "Tien", "Piccolo", "Gohan", "Vegeta", "Kid Trunks", "Goten", "Future Trunks", "Pan", "Android 18", "Android 16", "Android 17", "Android 19", "Android 20", "Beerus", "Chaozu", "Chi-Chi", "Launch", "Mr. Satan", "Oolong", "Puar", "Videl", "Whis", "Yajirobe", "Demon King Piccolo", "Freeza", "Cell", "Majin Buu", "Goku Black", "Zamasu", "Baba", "Bra", "Bardock", "Champa", "Dende", "Dr. Gero", "Captain Ginyu", "Grandpa Gohan", "Jaco", "King Kai", "Supreme Kai", "Elder Kai", "Mr. Popo", "Nappa", "Uub", "Pilaf", "Raditz", "Shenron", "Vados", "Zarbon", "Broly", "Cooler", "King Cold", "Garlic Jr", "King Vegeta", "Nail", "Guru", "Hit", "Super Saiyan Goku", "Super Saiyan 2 Goku", "Super Saiyan 3 Goku", "Super Saiyan Vegeta", "Super Saiyan 2 Vegeta", "Majin Vegeta", "Super Saiyan Gohan", "Super Saiyan 2 Gohan", "Super Saiyan Goten", "Super Saiyan Trunks", "Vegito", "Gogeta", "Super Saiyan Blue Goku", "Super Saiyan Blue Vegeta", "Mystic Gohan") 7 | Quit ..Sample(characters) 8 | } 9 | 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/cosFaker/Person.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Person 2 | { 3 | 4 | ClassMethod cpf(pPretty As %Boolean = 1) As %String 5 | { 6 | For k=1:1:9 { 7 | Set $List(CpfRoot,*+1) = $Random(10) 8 | } 9 | 10 | Set sum = 0 11 | For k=1:1:$ListLength(CpfRoot) { 12 | Set sum = sum + ($List(CpfRoot, k) * (10 - (k-1))) 13 | } 14 | 15 | Set firstValidator = sum # 11 16 | If (firstValidator=10)||(firstValidator=11)||(firstValidator<2) { 17 | Set firstValidator = 0 18 | } Else { 19 | Set firstValidator = 11 - firstValidator 20 | } 21 | 22 | Set $List(CpfRoot, *+1) = firstValidator, 23 | sum = 0 24 | 25 | For k=1:1:$ListLength(CpfRoot) { 26 | Set sum = sum + ($List(CpfRoot, k) * (11 - (k-1))) 27 | } 28 | 29 | Set secondValidator = sum # 11 30 | If (secondValidator=10) || (secondValidator=11)|| (secondValidator<2) { 31 | Set secondValidator = 0 32 | } Else { 33 | Set secondValidator = 11 - secondValidator 34 | } 35 | 36 | Set $List(CpfRoot, *+1) = secondValidator, 37 | cpf = $ListToString(CpfRoot,"") 38 | 39 | Set:$Length(cpf)>11 cpf = ..cpf(pPretty) 40 | 41 | Set:pPretty=$$$YES cpf = $Extract(cpf,1,3)_"."_$Extract(cpf,4,6)_"."_$Extract(cpf,7,9)_"-"_$Extract(cpf,10,11) 42 | Quit cpf 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/cosFaker/Finance.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Finance Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Amount(pMin As %Integer = 0, pMax As %Integer = 10000, pDec As %Integer = 2, pSeparator = ",", pSymbol As %String = "") As %String 5 | { 6 | Set value = pMin-10, dec = "" 7 | While ('..In(value, pMin, pMax)) { 8 | Set value = $Random(pMax + 1) 9 | } 10 | 11 | For k=1:1:pDec { 12 | Set dec = dec _ $Random(10) 13 | } 14 | 15 | Quit pSymbol _ value _ pSeparator _ dec 16 | } 17 | 18 | ClassMethod CreditCard(pType As %String = "") As %String 19 | { 20 | Set templates = ##class(%ArrayOfDataTypes).%New(), 21 | types = $ListBuild("visa", "mastercard", "american_express") 22 | 23 | Set:pType="" pType = ..Sample(types) 24 | 25 | Do templates.SetAt($ListBuild("4###########","4###-####-####-###"),"visa") 26 | Do templates.SetAt($ListBuild("5053-####-####-###","6771-89##-####-###"),"mastercard") 27 | Do templates.SetAt($ListBuild("34##-######-####"),"american_express") 28 | 29 | Quit ..MaskNumber(..Sample(templates.GetAt(pType))) 30 | } 31 | 32 | ClassMethod BitcoinAddress(pMin As %Integer = 24, pMax As %Integer = 34) As %String 33 | { 34 | Set:pMin<24 pMin = 24 35 | Set:pMax>34 pMax = 34 36 | Set length = "", bitcoinAddress = "", 37 | digits58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 38 | 39 | While ('..In(length, pMin, pMax)) { 40 | Set length = $Random(36) 41 | } 42 | 43 | For k=1:1:27{ 44 | Set i = $Random($Length(digits58)) + 1 45 | Set bitcoinAddress = bitcoinAddress _ $Extract(digits58,i) 46 | } 47 | 48 | Quit 1 _ bitcoinAddress 49 | } 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /src/cosFaker/Address.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Address Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod StreetSuffix() As %String 5 | { 6 | Quit ..SampleFromFile("street_suffix") 7 | } 8 | 9 | ClassMethod StreetPrefix() As %String 10 | { 11 | Quit ..SampleFromFile("street_prefix") 12 | } 13 | 14 | ClassMethod PostCode() As %String 15 | { 16 | Quit ..MaskNumber(..SampleFromFile("postcode")) 17 | } 18 | 19 | ClassMethod StreetName() As %String 20 | { 21 | Set suffix = ..StreetSuffix() 22 | Set:suffix'="" suffix = suffix _ " " 23 | Quit ..StreetPrefix() _ " " _ suffix _ ##class(cosFaker.Name).FullName(2) 24 | } 25 | 26 | ClassMethod Latitude() 27 | { 28 | Quit ($Random(180 * 10000) / 10000.0) - 90.0 29 | } 30 | 31 | ClassMethod Longitude() 32 | { 33 | Quit ($Random(360 * 10000) / 10000.0 ) - 180.0 34 | } 35 | 36 | ClassMethod Capital(pLocation As %String = "") As %String 37 | { 38 | Quit ..SampleFromFile("capital") 39 | } 40 | 41 | ClassMethod State(pFullName As %Boolean = 0) As %String 42 | { 43 | Quit ..SampleFromFile("state_"_$Case(pFullName,0:"abbr",1:"full")) 44 | } 45 | 46 | ClassMethod City(pState As %String = "") As %String 47 | { 48 | Set:pState="" pState = ..SampleFromFile("state_abbr") 49 | Quit ..SampleFromFile("city",pState) 50 | } 51 | 52 | ClassMethod Country(pAbrev As %Boolean = 0) 53 | { 54 | Quit ..SampleFromFile("country_"_$Case(pAbrev,0:"full",1:"abbr")) 55 | } 56 | 57 | ClassMethod SecondaryAddress() 58 | { 59 | Quit ..MaskNumber(..SampleFromFile("secondary_address")) 60 | } 61 | 62 | ClassMethod BuildingNumber() 63 | { 64 | Quit ..MaskNumber(..SampleFromFile("number")) 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/cosFaker/File.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.File 2 | { 3 | 4 | ClassMethod Extension() As %String 5 | { 6 | Set ext = $ListBuild("flac", "mp3", "wav", "bmp", "gif", "jpeg", "jpg", "png", "tiff", "css", "csv", "html", "js", "json", "txt", "mp4", "avi", "mov", "webm", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "odt", "ods", "odp", "pages", "numbers", "key", "pdf") 7 | Quit $List(ext, $Random($ListLength(ext))+1) 8 | } 9 | 10 | ClassMethod MimeType() As %String 11 | { 12 | Set ext = $ListBuild("application/atom+xml", "application/ecmascript", "application/EDI-X12", "application/EDIFACT", "application/json", "application/javascript", "application/ogg", "application/pdf", "application/postscript", "application/rdf+xml", "application/rss+xml", "application/soap+xml", "application/font-woff", "application/xhtml+xml", "application/xml-dtd", "application/xop+xml", "application/zip", "application/gzip", "audio/basic", "audio/L24", "audio/mp4", "audio/mpeg", "audio/ogg", "audio/vorbis", "audio/vnd.rn-realaudio", "audio/vnd.wave", "audio/webm", "image/gif", "image/jpeg", "image/pjpeg", "image/png", "image/svg+xml", "image/tiff", "image/vnd.microsoft.icon", "message/http", "message/imdn+xml", "message/partial", "message/rfc822", "model/example", "model/iges", "model/mesh", "model/vrml", "model/x3d+binary", "model/x3d+vrml", "model/x3d+xml", "multipart/mixed", "multipart/alternative", "multipart/related", "multipart/form-data", "multipart/signed", "multipart/encrypted", "text/cmd", "text/css", "text/csv", "text/html", "text/javascript", "text/plain", "text/vcard", "text/xml", "video/mpeg", "video/mp4", "video/ogg", "video/quicktime", "video/webm", "video/x-matroska", "video/x-ms-wmv", "video/x-flv") 13 | Quit $List(ext, $Random($ListLength(ext))+1) 14 | } 15 | 16 | ClassMethod Filename(pDir As %String = "", pName As %String = "", pExt As %String = "", pDirectorySeparator As %String = "/") As %String 17 | { 18 | Set:pDir="" pDir = ##class(cosFaker.Internet).Slug() 19 | Set:pName="" pName = ##class(cosFaker.Lorem).Word() 20 | Set:pExt="" pExt = ..Extension() 21 | 22 | Quit $ListToString($ListBuild(pDir, pName _ "." _ pExt),pDirectorySeparator) 23 | } 24 | 25 | } 26 | 27 | -------------------------------------------------------------------------------- /src/cosFaker/Commerce.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Commerce Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod ProductName() As %String 5 | { 6 | Quit ..SampleFromFile("product_name") 7 | } 8 | 9 | ClassMethod Product() As %String 10 | { 11 | Quit:..GetLang()=..#PtBr ..SampleFromFile("product_adjective")_" "_..ProductName()_" "_$ZConvert(..SampleFromFile("color"),"S") 12 | Quit ..SampleFromFile("product_adjective")_" "_$ZConvert(..SampleFromFile("color"),"L")_" "_$ZConvert(..ProductName(),"L") 13 | } 14 | 15 | ClassMethod PromotionCode() As %String 16 | { 17 | Quit ..SampleFromFile("promotion_adjective")_..SampleFromFile("promotion_noum")_..MaskNumber("#####") 18 | } 19 | 20 | ClassMethod Color() As %String 21 | { 22 | Quit ..SampleFromFile("color") 23 | } 24 | 25 | ClassMethod Department() As %String 26 | { 27 | Quit ..SampleFromFile("department") 28 | } 29 | 30 | ClassMethod Price(pMin As %Integer = 0, pMax As %Integer = 1000, pDec As %Integer = 2, pSymbol As %String = "") 31 | { 32 | Set bOk = $$$NO, $Piece(dec,"9",pDec+1)="", $Piece(tmp,"0",pDec+1)="" 33 | 34 | While bOk = $$$NO { 35 | Set randdec = $Random(dec) 36 | Set rand = $Random(pMax ) _ "." _ randdec _ $Extract(tmp, 0, $Length(tmp)-$Length(randdec)) 37 | Set:((rand >= pMin)&&(rand <= pMax)) bOk = $$$YES 38 | } 39 | 40 | Quit pSymbol _ rand 41 | } 42 | 43 | ClassMethod CNPJ(pPretty As %Boolean = 1) As %String 44 | { 45 | #define r $Random(9) 46 | Set n1 = $$$r, 47 | n2 = $$$r, 48 | n3 = $$$r, 49 | n4 = $$$r, 50 | n5 = $$$r, 51 | n6 = $$$r, 52 | n7 = $$$r, 53 | n8 = $$$r, 54 | n9 = 0, 55 | n10 = 0, 56 | n11 = 0, 57 | n12 = 1 58 | Set d1 = (n12*2) + (n11*3) + (n10*4) + (n9*5) + (n8*6) + (n7*7) + (n6*8) + (n5*9) + (n4*2) + (n3*3) + (n2*4) + (n1*5) 59 | Set d1 = 11 - ..mod(d1,11) 60 | Set:d1>=10 d1 = 0 61 | Set d2 = (d1*2) + (n12*3) + (n11*4) + (n10*5) + (n9*6) + (n8*7) + (n7*8) + (n6*9) + (n5*2) + (n4*3) + (n3*4) + (n2*5) + (n1*6) 62 | Set d2 = 11 - (..mod(d2,11)) 63 | Set:d2>=10 d2 = 0 64 | Set ret = "" 65 | Set:pPretty ret = n1_n2_"."_n3_n4_n5_"."_n6_n7_n8_"/"_n9_n10_n11_n12_"-"_d1_d2 66 | Set:'pPretty ret = n1_n2_n3_n4_n5_n6_n7_n8_n9_n10_n11_n12_d1_d2 67 | Quit ret 68 | } 69 | 70 | ClassMethod mod(div1, div2) [ Private ] 71 | { 72 | Quit $Number(div1 - (((div1/div2)\1)*div2),0) 73 | } 74 | 75 | } 76 | 77 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cosFaker [![GitHub issues](https://img.shields.io/github/issues/henryhamon/cosfaker.svg)](https://github.com/henryhamon/cosfaker/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/henryhamon/cosfaker/master/LICENSE) 2 | Generate massive amounts of fake data for Intersystems Caché 3 | 4 | The language of data is according to configuration of your Caché (Now works with Pt-Br and En-Us(Default)). 5 | 6 | ## Valid Types 7 | * Address (Street, Latitude, Longitude, City, State, Capital, Country, Street Suffix, Street Prefix, Postcode, Secondary Address) 8 | * App (Function name) 9 | * Coffee (Blend name, Variety, Notes, Origin) 10 | * Color (Hexadecimal, Name, RGB) 11 | * Commerce (Price, CNPJ, Color, Product, Product Name, Promotion Code) 12 | * Company (Profession, Industry) 13 | * Dates (Forward, Backward) 14 | * DragonBall (Character) 15 | * File (Filename, Extension, MimeType) 16 | * Finance (Amount, Credit Card, Bitcoin Address) 17 | * Game (Card, Mortal Kombat, Street Fighter) 18 | * Internet (Username, Email, Protocol, Domain Word, Domain Name, Avatar, Url, Slug, IPV4, IPV6,MAC Address) 19 | * Job (Title, Skills, Field) 20 | * Lorem (Words, Sentences, Paragraphs, Lines, Text, Hipster) 21 | * Name (First name, Last Name, Full Name, Suffix) 22 | * Person (CPF (Brazilian ID)) 23 | * Phone (Area code, Phone number, Cell phone) 24 | * Pokemon (Pokemons) 25 | * StarWars (Character, Droid, Planet, Quote, Specie, Vehicle, Wookie word, Wookie Sentence) 26 | * UFC (Category, Fighter, Fighter by category, Nickname) 27 | 28 | 29 | ## Usage 30 | 31 | ### On Populate 32 | 33 | You can use on Populate event 34 | 35 | ```cos 36 | Method OnPopulate() As %Status [ ServerOnly = 1 ] 37 | { 38 | Set ..Login = ##class(cosFaker.Internet).UserName("John","Doe") 39 | Set ..Url = ##class(cosFaker.Internet).DomainWord() 40 | } 41 | ``` 42 | Or on a simple Set 43 | 44 | ```cos 45 | Set ..Name = ##class(cosFaker.Name).FullName() 46 | ``` 47 | 48 | ### SQL Class 49 | 50 | You can generate data directly on a table 51 | 52 | ```cos 53 | Do ##class(cosFaker.SQL).Insert("Sample_Data.Clients","City,Name,Salary","city SC,name 2,price 1000 2000 2 R$",2) 54 | //Same as: 55 | //INSERT INTO Sample_Data.Clients (City,Name,Salary) VALUES ('Celso Ramos','Luiggi Dias Nunes Saraiva','R$1654.30') 56 | //INSERT INTO Sample_Data.Clients (City,Name,Salary) VALUES ('Nova Veneza','Fabiano da Costa','R$1255.13') 57 | ``` 58 | 59 | ### JSON Class 60 | 61 | You can generate data on JSON string or in an object, only passing a JSON string as shown above. 62 | 63 | Examples showing JSON strings populated: 64 | ```cos 65 | Write ##class(cosFaker.JSON).GetDataJSONFromJSON("{Nome:'name 2',Cidade:'city SC',CPF:'cpf 1',Description:'slug ""person sample example"" ;'}") 66 | // { 67 | // "CPF":"661.254.048-62", 68 | // "Cidade":"Brunópolis", 69 | // "Nome":"Jonathan Ribeiro Ribeiro", 70 | // "Description":"person;sample;example" 71 | // } 72 | ``` 73 | 74 | ```cos 75 | //Suppose you want a person with name, street, phone and his 3 preferred Pokemons 76 | Write ##class(cosFaker.JSON).GetDataJSONFromJSON("{person:['name','street','phone','3 pokemon']}") 77 | // {"person": 78 | // [ 79 | // "Yango Nogueira", 80 | // "Viela General Sirineu Nogueira", 81 | // "(44) 0968-2926", 82 | // ["Bayleef","Haunter","Golurk"] 83 | // ] 84 | // } 85 | ``` 86 | 87 | And example showing Object populated: 88 | ```cos 89 | Set person = ##class(cosFaker.JSON).GetDataOBJFromJSON("{name:'name 2',birth:'date',profession:'profession',pokemons:'3 pokemon'}",.tSC) 90 | 91 | Write person.name 92 | // Flávio Silveira 93 | 94 | Set listOfPokemons = person.pokemons 95 | Write listOfPokemons.GetAt(1) 96 | // Diancie 97 | 98 | Write listOfPokemons.Count() 99 | // 3 100 | ``` 101 | -------------------------------------------------------------------------------- /src/cosFaker/StarWars.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.StarWars 2 | { 3 | 4 | ClassMethod Characters() As %String 5 | { 6 | Set characters = $ListBuild("Padme Amidala", "Jar Jar Binks", "Borvo the Hutt", "Darth Caedus", "Boba Fett", "Jabba the Hutt", "Obi-Wan Kenobi", "Darth Maul", "Leia Organa", "Sheev Palpatine", 7 | "Kylo Ren", "Darth Sidious", "Anakin Skywalker", "Luke Skywalker", "Ben Solo", "Han Solo", "Darth Vader", "Watto", "Mace Windu", "Yoda", "Count Dooku", "Sebulba", 8 | "Qui-Gon Jinn", "Chewbacca", "Jango Fett", "Lando Calrissian", "Bail Organa", "Wedge Antilles", "Poe Dameron", "Ki-Adi-Mundi", "Nute Gunray", "Panaka", "Rune Haako") 9 | 10 | Quit ..Sample(characters) 11 | } 12 | 13 | ClassMethod Droids() As %String 14 | { 15 | Set droids = $ListBuild("2-1B", "4-LOM", "ASP", "B2-RP", "B1", "BD-3000", "FA-4", "GH-7", "GNK", "LM-432", "ID9", "11-4D", "2-1B", "327-T", "4-LOM", "B4-D4", 16 | "NR-N99", "C-3PO", "R2-D2", "BB-8", "R2-Q5") 17 | 18 | Quit ..Sample(droids) 19 | } 20 | 21 | ClassMethod Planets() As %String 22 | { 23 | Set planets = $ListBuild("Alderaan", "Bespin", "Coruscant", "DQar", "Dagobah", "Endor", "Geonosis", "Hoth", 24 | "Hosnian Prime", "Jakku", "Kamino", "Kashyyyk", "Lothal", "Mustafar", "Naboo", 25 | "Sullust", "Takodana", "Tatooine", "Utapau", "Yavin") 26 | 27 | Quit ..Sample(planets) 28 | } 29 | 30 | ClassMethod Quotes() As %String 31 | { 32 | Set quotes = $ListBuild("Never tell me the odds!", "Well, you said you wanted to be around when I made a mistake.", "You will never find a more wretched hive of scum and villainy. We must be cautious.", "Wars not make one great.", 33 | "You do have your moments. Not many, but you have them.", "Now, witness the power of this fully operational battle station.", "No reward is worth this.", "Shut him up or shut him down.", 34 | "I have a bad feeling about this.", "Who's the more foolish; the fool, or the fool who follows him?", "Would somebody get this big walking carpet out of my way?", "I find your lack of faith disturbing.", 35 | "If they follow standard Imperial procedure, they'll dump their garbage before they go to light-speed.", "Only at the end do you realize the power of the Dark Side.", "Bounty hunters! We don't need this scum.", 36 | "It's not impossible. I used to bullseye womp rats in my T-16 back home, they're not much bigger than two meters.", "Strike me down, and I will become more powerful than you could possibly imagine.", 37 | "You know, that little droid is going to cause me a lot of trouble.", "If you're saying that coming here was a bad idea, I'm starting to agree with you.", "You'll find I'm full of surprises!", 38 | "Aren't you a little short for a Stormtrooper?", "You are unwise to lower your defenses!", "R2-D2, you know better than to trust a strange computer!", "Truly wonderful, the mind of a child is.", 39 | "That is why you fail.", "A Jedi uses the Force for knowledge and defense, never for attack.", "Adventure. Excitement. A Jedi craves not these things.", "Judge me by my size, do you?", 40 | "Fear is the path to the dark side... fear leads to anger... anger leads to hate... hate leads to suffering.", "Do. Or do not. There is no try.") 41 | 42 | Quit ..Sample(quotes) 43 | } 44 | 45 | ClassMethod Species() As %String 46 | { 47 | Set species = $ListBuild("Ewok", "Hutt", "Gungan", "Ithorian", "Jawa", "Neimoidian", "Sullustan", "Wookiee", "Mon Calamari") 48 | 49 | Quit ..Sample(species) 50 | } 51 | 52 | ClassMethod Vehicles() As %String 53 | { 54 | Set vehicles = $ListBuild("V-Wing Fighter", "ATT Battle Tank", "Naboo N-1 Starfighter", "Vulture Droid", "Republic Cruiser", "Naboo Royal Starship", "Gungan Bongo Submarine", "Flash Speeder", "Trade Federation Battleship", "Millennium Falcon", 55 | "Sith Infiltrator", "AT-ST Walker", "TIE Bomber", "Imperial Shuttle", "Sandcrawler", "TIE Interceptor", "Speeder Bike", "Death Star", "AT-AT Walker", "Imperial Star Destroyer", "X-Wing Fighter") 56 | 57 | Quit ..Sample(vehicles) 58 | } 59 | 60 | ClassMethod WookieWords() As %String 61 | { 62 | Set words = $ListBuild("wyaaaaaa", "ruh", "huewaa", "muaa", "mumwa", "wua", "ga", "ma", "ahuma", "ooma", "youw", "kabukk", "wyogg", 63 | "gwyaaaag", "roooarrgh", "ur", "ru", "roo", "hnn-rowr", "yrroonn", "nng", "rarr") 64 | 65 | Quit ..Sample(words) 66 | } 67 | 68 | ClassMethod Sample(pList) As %String [ Private ] 69 | { 70 | Quit $List(pList, $Random($ListLength(pList)) + 1) 71 | } 72 | 73 | ClassMethod WookieSentence(pSentenceCount As %Integer = "") 74 | { 75 | Set:pSentenceCount="" pSentenceCount = $Random(6)+1 76 | 77 | For k=1:1:pSentenceCount { 78 | Set sentence = "", 79 | punctuation = $Case(($Random(4) + 1),1:".",2:"?",3:"!",:" ") 80 | 81 | For k=1:1:($Random(15)+1) { 82 | Set $List(sentence, *+1) = ..WookieWords() 83 | } 84 | 85 | Set $List(sentences,*+1) = $ListToString(sentence," ") _ punctuation 86 | } 87 | 88 | Quit $ListToString(sentences," ") 89 | } 90 | 91 | } 92 | 93 | -------------------------------------------------------------------------------- /src/cosFaker/Lorem.cls: -------------------------------------------------------------------------------- 1 | Class cosFaker.Lorem Extends cosFaker.lib.core 2 | { 3 | 4 | ClassMethod Word() As %String 5 | { 6 | Quit ..LoremIpsum() 7 | } 8 | 9 | ClassMethod Words(pNum As %Integer = "") As %String 10 | { 11 | Set:pNum="" pNum = 3 12 | For k=1:1:pNum { 13 | Set $List(words,*+1) = ..Word() 14 | } 15 | Quit $ListToString(words, " ") 16 | } 17 | 18 | ClassMethod Sentence(pWordCount As %Integer = "", pMin As %Integer = 3, pMax As %Integer = 10) As %String 19 | { 20 | If pWordCount = "" { 21 | For { 22 | Set pWordCount = $Random(pMax) 23 | Quit:((pWordCount>pMin)&&(pWordCount < pMax)) 24 | } 25 | } 26 | 27 | Set sentence = ..Words(pWordCount) 28 | Quit $ZConvert($Extract(sentence,1,1), "U") _ $Extract(sentence,2,*) _ "." 29 | } 30 | 31 | ClassMethod Sentences(pSentenceCount As %Integer = "", pSeparator As %String = "") As %String 32 | { 33 | If pSentenceCount = "" { 34 | For { 35 | Set pSentenceCount = $Random(6) 36 | Quit:pSentenceCount>2 37 | } 38 | } 39 | 40 | Set:pSeparator="" pSeparator = " " 41 | 42 | For k=1:1:pSentenceCount { 43 | Set $List(sentences,*+1) = ..Sentence() 44 | } 45 | 46 | Quit $ListToString($Get(sentences), pSeparator) 47 | } 48 | 49 | ClassMethod Paragraph(pSentenceCount As %Integer = "") As %String 50 | { 51 | Set:pSentenceCount="" pSentenceCount = 3 52 | Quit ..Sentences(pSentenceCount + $Random(3)) 53 | } 54 | 55 | ClassMethod Paragraphs(pParagraphCount As %Integer = "", pSeparator As %String = "") As %String 56 | { 57 | Set:pParagraphCount="" pParagraphCount = 3 58 | Set:pSeparator="" pSeparator = $Char(10) _ $Char(13) ; \n \r OR LF CR 59 | 60 | For k=1:1:pParagraphCount { 61 | Set $List(paragraphs,*+1) = ..Paragraph() 62 | } 63 | 64 | Quit $ListToString($Get(paragraphs), pSeparator) 65 | } 66 | 67 | ClassMethod Lines(pLineCount As %Integer = "") As %String 68 | { 69 | If pLineCount = "" { 70 | For { 71 | Set pLineCount = $Random(5) 72 | Quit:pLineCount>1 73 | } 74 | } 75 | 76 | Quit ..Sentences(pLineCount, $Char(10)) 77 | } 78 | 79 | ClassMethod Text(pTimes As %Integer = 1) 80 | { 81 | Set output = "" 82 | For k=1:1:pTimes { 83 | Set rand = $Random(7) 84 | 85 | If rand = 1 { Set output = output _ ..Word() } 86 | ElseIf rand = 2 { Set output = output _ ..Words() } 87 | ElseIf rand = 3 { Set output = output _ ..Sentence() } 88 | ElseIf rand = 4 { Set output = output _ ..Sentences() } 89 | ElseIf rand = 5 { Set output = output _ ..Paragraph() } 90 | ElseIf rand = 6 { Set output = output _ ..Paragraphs() } 91 | ElseIf rand = 7 { Set output = output _ ..Lines() } 92 | 93 | } 94 | 95 | Quit output 96 | } 97 | 98 | ClassMethod LoremIpsum() As %String [ Private ] 99 | { 100 | Set $List(lorem, *+1) = "alias" 101 | Set $List(lorem, *+1) = "consequatur" 102 | Set $List(lorem, *+1) = "aut" 103 | Set $List(lorem, *+1) = "perferendis" 104 | Set $List(lorem, *+1) = "sit" 105 | Set $List(lorem, *+1) = "voluptatem" 106 | Set $List(lorem, *+1) = "accusantium" 107 | Set $List(lorem, *+1) = "doloremque" 108 | Set $List(lorem, *+1) = "aperiam" 109 | Set $List(lorem, *+1) = "eaque" 110 | Set $List(lorem, *+1) = "ipsa" 111 | Set $List(lorem, *+1) = "quae" 112 | Set $List(lorem, *+1) = "ab" 113 | Set $List(lorem, *+1) = "illo" 114 | Set $List(lorem, *+1) = "inventore" 115 | Set $List(lorem, *+1) = "veritatis" 116 | Set $List(lorem, *+1) = "et" 117 | Set $List(lorem, *+1) = "quasi" 118 | Set $List(lorem, *+1) = "architecto" 119 | Set $List(lorem, *+1) = "beatae" 120 | Set $List(lorem, *+1) = "vitae" 121 | Set $List(lorem, *+1) = "dicta" 122 | Set $List(lorem, *+1) = "sunt" 123 | Set $List(lorem, *+1) = "explicabo" 124 | Set $List(lorem, *+1) = "aspernatur" 125 | Set $List(lorem, *+1) = "aut" 126 | Set $List(lorem, *+1) = "odit" 127 | Set $List(lorem, *+1) = "aut" 128 | Set $List(lorem, *+1) = "fugit" 129 | Set $List(lorem, *+1) = "sed" 130 | Set $List(lorem, *+1) = "quia" 131 | Set $List(lorem, *+1) = "consequuntur" 132 | Set $List(lorem, *+1) = "magni" 133 | Set $List(lorem, *+1) = "dolores" 134 | Set $List(lorem, *+1) = "eos" 135 | Set $List(lorem, *+1) = "qui" 136 | Set $List(lorem, *+1) = "ratione" 137 | Set $List(lorem, *+1) = "voluptatem" 138 | Set $List(lorem, *+1) = "sequi" 139 | Set $List(lorem, *+1) = "nesciunt" 140 | Set $List(lorem, *+1) = "neque" 141 | Set $List(lorem, *+1) = "dolorem" 142 | Set $List(lorem, *+1) = "ipsum" 143 | Set $List(lorem, *+1) = "quia" 144 | Set $List(lorem, *+1) = "dolor" 145 | Set $List(lorem, *+1) = "sit" 146 | Set $List(lorem, *+1) = "amet" 147 | Set $List(lorem, *+1) = "consectetur" 148 | Set $List(lorem, *+1) = "adipisci" 149 | Set $List(lorem, *+1) = "velit" 150 | Set $List(lorem, *+1) = "sed" 151 | Set $List(lorem, *+1) = "quia" 152 | Set $List(lorem, *+1) = "non" 153 | Set $List(lorem, *+1) = "numquam" 154 | Set $List(lorem, *+1) = "eius" 155 | Set $List(lorem, *+1) = "modi" 156 | Set $List(lorem, *+1) = "tempora" 157 | Set $List(lorem, *+1) = "incidunt" 158 | Set $List(lorem, *+1) = "ut" 159 | Set $List(lorem, *+1) = "labore" 160 | Set $List(lorem, *+1) = "et" 161 | Set $List(lorem, *+1) = "dolore" 162 | Set $List(lorem, *+1) = "magnam" 163 | Set $List(lorem, *+1) = "aliquam" 164 | Set $List(lorem, *+1) = "quaerat" 165 | Set $List(lorem, *+1) = "voluptatem" 166 | Set $List(lorem, *+1) = "ut" 167 | Set $List(lorem, *+1) = "enim" 168 | Set $List(lorem, *+1) = "ad" 169 | Set $List(lorem, *+1) = "minima" 170 | Set $List(lorem, *+1) = "veniam" 171 | Set $List(lorem, *+1) = "quis" 172 | Set $List(lorem, *+1) = "nostrum" 173 | Set $List(lorem, *+1) = "exercitationem" 174 | Set $List(lorem, *+1) = "ullam" 175 | Set $List(lorem, *+1) = "corporis" 176 | Set $List(lorem, *+1) = "nemo" 177 | Set $List(lorem, *+1) = "enim" 178 | Set $List(lorem, *+1) = "ipsam" 179 | Set $List(lorem, *+1) = "voluptatem" 180 | Set $List(lorem, *+1) = "quia" 181 | Set $List(lorem, *+1) = "voluptas" 182 | Set $List(lorem, *+1) = "sit" 183 | Set $List(lorem, *+1) = "suscipit" 184 | Set $List(lorem, *+1) = "laboriosam" 185 | Set $List(lorem, *+1) = "nisi" 186 | Set $List(lorem, *+1) = "ut" 187 | Set $List(lorem, *+1) = "aliquid" 188 | Set $List(lorem, *+1) = "ex" 189 | Set $List(lorem, *+1) = "ea" 190 | Set $List(lorem, *+1) = "commodi" 191 | Set $List(lorem, *+1) = "consequatur" 192 | Set $List(lorem, *+1) = "quis" 193 | Set $List(lorem, *+1) = "autem" 194 | Set $List(lorem, *+1) = "vel" 195 | Set $List(lorem, *+1) = "eum" 196 | Set $List(lorem, *+1) = "iure" 197 | Set $List(lorem, *+1) = "reprehenderit" 198 | Set $List(lorem, *+1) = "qui" 199 | Set $List(lorem, *+1) = "in" 200 | Set $List(lorem, *+1) = "ea" 201 | Set $List(lorem, *+1) = "voluptate" 202 | Set $List(lorem, *+1) = "velit" 203 | Set $List(lorem, *+1) = "esse" 204 | Set $List(lorem, *+1) = "quam" 205 | Set $List(lorem, *+1) = "nihil" 206 | Set $List(lorem, *+1) = "molestiae" 207 | Set $List(lorem, *+1) = "et" 208 | Set $List(lorem, *+1) = "iusto" 209 | Set $List(lorem, *+1) = "odio" 210 | Set $List(lorem, *+1) = "dignissimos" 211 | Set $List(lorem, *+1) = "ducimus" 212 | Set $List(lorem, *+1) = "qui" 213 | Set $List(lorem, *+1) = "blanditiis" 214 | Set $List(lorem, *+1) = "praesentium" 215 | Set $List(lorem, *+1) = "laudantium" 216 | Set $List(lorem, *+1) = "totam" 217 | Set $List(lorem, *+1) = "rem" 218 | Set $List(lorem, *+1) = "voluptatum" 219 | Set $List(lorem, *+1) = "deleniti" 220 | Set $List(lorem, *+1) = "atque" 221 | Set $List(lorem, *+1) = "corrupti" 222 | Set $List(lorem, *+1) = "quos" 223 | Set $List(lorem, *+1) = "dolores" 224 | Set $List(lorem, *+1) = "et" 225 | Set $List(lorem, *+1) = "quas" 226 | Set $List(lorem, *+1) = "molestias" 227 | Set $List(lorem, *+1) = "excepturi" 228 | Set $List(lorem, *+1) = "sint" 229 | Set $List(lorem, *+1) = "occaecati" 230 | Set $List(lorem, *+1) = "cupiditate" 231 | Set $List(lorem, *+1) = "non" 232 | Set $List(lorem, *+1) = "provident" 233 | Set $List(lorem, *+1) = "sed" 234 | Set $List(lorem, *+1) = "ut" 235 | Set $List(lorem, *+1) = "perspiciatis" 236 | Set $List(lorem, *+1) = "unde" 237 | Set $List(lorem, *+1) = "omnis" 238 | Set $List(lorem, *+1) = "iste" 239 | Set $List(lorem, *+1) = "natus" 240 | Set $List(lorem, *+1) = "error" 241 | Set $List(lorem, *+1) = "similique" 242 | Set $List(lorem, *+1) = "sunt" 243 | Set $List(lorem, *+1) = "in" 244 | Set $List(lorem, *+1) = "culpa" 245 | Set $List(lorem, *+1) = "qui" 246 | Set $List(lorem, *+1) = "officia" 247 | Set $List(lorem, *+1) = "deserunt" 248 | Set $List(lorem, *+1) = "mollitia" 249 | Set $List(lorem, *+1) = "animi" 250 | Set $List(lorem, *+1) = "id" 251 | Set $List(lorem, *+1) = "est" 252 | Set $List(lorem, *+1) = "laborum" 253 | Set $List(lorem, *+1) = "et" 254 | Set $List(lorem, *+1) = "dolorum" 255 | Set $List(lorem, *+1) = "fuga" 256 | Set $List(lorem, *+1) = "et" 257 | Set $List(lorem, *+1) = "harum" 258 | Set $List(lorem, *+1) = "quidem" 259 | Set $List(lorem, *+1) = "rerum" 260 | Set $List(lorem, *+1) = "facilis" 261 | Set $List(lorem, *+1) = "est" 262 | Set $List(lorem, *+1) = "et" 263 | Set $List(lorem, *+1) = "expedita" 264 | Set $List(lorem, *+1) = "distinctio" 265 | Set $List(lorem, *+1) = "nam" 266 | Set $List(lorem, *+1) = "libero" 267 | Set $List(lorem, *+1) = "tempore" 268 | Set $List(lorem, *+1) = "cum" 269 | Set $List(lorem, *+1) = "soluta" 270 | Set $List(lorem, *+1) = "nobis" 271 | Set $List(lorem, *+1) = "est" 272 | Set $List(lorem, *+1) = "eligendi" 273 | Set $List(lorem, *+1) = "optio" 274 | Set $List(lorem, *+1) = "cumque" 275 | Set $List(lorem, *+1) = "nihil" 276 | Set $List(lorem, *+1) = "impedit" 277 | Set $List(lorem, *+1) = "quo" 278 | Set $List(lorem, *+1) = "porro" 279 | Set $List(lorem, *+1) = "quisquam" 280 | Set $List(lorem, *+1) = "est" 281 | Set $List(lorem, *+1) = "qui" 282 | Set $List(lorem, *+1) = "minus" 283 | Set $List(lorem, *+1) = "id" 284 | Set $List(lorem, *+1) = "quod" 285 | Set $List(lorem, *+1) = "maxime" 286 | Set $List(lorem, *+1) = "placeat" 287 | Set $List(lorem, *+1) = "facere" 288 | Set $List(lorem, *+1) = "possimus" 289 | Set $List(lorem, *+1) = "omnis" 290 | Set $List(lorem, *+1) = "voluptas" 291 | Set $List(lorem, *+1) = "assumenda" 292 | Set $List(lorem, *+1) = "est" 293 | Set $List(lorem, *+1) = "omnis" 294 | Set $List(lorem, *+1) = "dolor" 295 | Set $List(lorem, *+1) = "repellendus" 296 | Set $List(lorem, *+1) = "temporibus" 297 | Set $List(lorem, *+1) = "autem" 298 | Set $List(lorem, *+1) = "quibusdam" 299 | Set $List(lorem, *+1) = "et" 300 | Set $List(lorem, *+1) = "aut" 301 | Set $List(lorem, *+1) = "consequatur" 302 | Set $List(lorem, *+1) = "vel" 303 | Set $List(lorem, *+1) = "illum" 304 | Set $List(lorem, *+1) = "qui" 305 | Set $List(lorem, *+1) = "dolorem" 306 | Set $List(lorem, *+1) = "eum" 307 | Set $List(lorem, *+1) = "fugiat" 308 | Set $List(lorem, *+1) = "quo" 309 | Set $List(lorem, *+1) = "voluptas" 310 | Set $List(lorem, *+1) = "nulla" 311 | Set $List(lorem, *+1) = "pariatur" 312 | Set $List(lorem, *+1) = "at" 313 | Set $List(lorem, *+1) = "vero" 314 | Set $List(lorem, *+1) = "eos" 315 | Set $List(lorem, *+1) = "et" 316 | Set $List(lorem, *+1) = "accusamus" 317 | Set $List(lorem, *+1) = "officiis" 318 | Set $List(lorem, *+1) = "debitis" 319 | Set $List(lorem, *+1) = "aut" 320 | Set $List(lorem, *+1) = "rerum" 321 | Set $List(lorem, *+1) = "necessitatibus" 322 | Set $List(lorem, *+1) = "saepe" 323 | Set $List(lorem, *+1) = "eveniet" 324 | Set $List(lorem, *+1) = "ut" 325 | Set $List(lorem, *+1) = "et" 326 | Set $List(lorem, *+1) = "voluptates" 327 | Set $List(lorem, *+1) = "repudiandae" 328 | Set $List(lorem, *+1) = "sint" 329 | Set $List(lorem, *+1) = "et" 330 | Set $List(lorem, *+1) = "molestiae" 331 | Set $List(lorem, *+1) = "non" 332 | Set $List(lorem, *+1) = "recusandae" 333 | Set $List(lorem, *+1) = "itaque" 334 | Set $List(lorem, *+1) = "earum" 335 | Set $List(lorem, *+1) = "rerum" 336 | Set $List(lorem, *+1) = "hic" 337 | Set $List(lorem, *+1) = "tenetur" 338 | Set $List(lorem, *+1) = "a" 339 | Set $List(lorem, *+1) = "sapiente" 340 | Set $List(lorem, *+1) = "delectus" 341 | Set $List(lorem, *+1) = "ut" 342 | Set $List(lorem, *+1) = "aut" 343 | Set $List(lorem, *+1) = "reiciendis" 344 | Set $List(lorem, *+1) = "voluptatibus" 345 | Set $List(lorem, *+1) = "maiores" 346 | Set $List(lorem, *+1) = "doloribus" 347 | Set $List(lorem, *+1) = "asperiores" 348 | Set $List(lorem, *+1) = "repellat" 349 | Quit ..Sample(lorem) 350 | } 351 | 352 | ClassMethod Hipster(pParagraphCount As %Integer = "", pSeparator As %String = "") As %String 353 | { 354 | Set:pParagraphCount="" pParagraphCount = 3 355 | Set:pSeparator="" pSeparator = $Char(10) _ $Char(13) ; \n \r OR LF CR 356 | Set begin = $ListFromString(..GetFile("hipster_begin"),"|") 357 | Set middle = $ListFromString(..GetFile("hipster_middle1"),"|") 358 | Set middle2 = $ListFromString(..GetFile("hipster_middle2"),"|") 359 | Set TheEnd = $ListFromString(..GetFile("hipster_end"),"|") 360 | For k=1:1:pParagraphCount { 361 | S paragraph = $ListGet(begin,$Random($ListLength(begin)) + 1) 362 | S paragraph = paragraph _ $ListGet(middle,$Random($ListLength(middle)) + 1) 363 | S paragraph = paragraph _ $ListGet(middle2,$Random($ListLength(middle2)) + 1) 364 | S paragraph = paragraph _ $ListGet(TheEnd,$Random($ListLength(TheEnd)) + 1) 365 | Set $List(paragraphs,*+1) = paragraph 366 | } 367 | 368 | Kill begin, TheEnd, middle, middle2 369 | Quit $ZConvert($ListToString($Get(paragraphs), pSeparator),"I","UTF8") 370 | } 371 | 372 | } 373 | 374 | --------------------------------------------------------------------------------