WhiteHatBox
Official Twitter Account
Get Support
Create Support Ticket
Share Page
Following(0)
Partner List
TurboGolom

logic combination of random files

ReplyThanks 2017/09/08 05:53:39 1 0

Hello Community, so im working for a long time on a project which is breaking my brain at the moment.

So im working on an adress generator which is creating random adressinformations

the adress looks like: Firstname,Lastname,Country,City,Street,Streetnumber,ZIP and some other things

Each information is stored into a seperated txt file.


What i wanna do ?

So the User is pressing the "generate" Button and the Bot should generate a complete random adressinformation set wiht a logic behind it.


what do i mean with "logic"?

the bot takes a random first and last name.

After that he choose from 16 Countrys 1.

Depending on the choosen Country he takes a City which is inside this Country.

Depending on the choosen City he takes a Street which is inside this City

Depending on the choosen City he takes a ZIP code for this City


My idea how to solve that was:

making a random variable with the number 1-16

making a case function with the 16 Countrys

Depending on the random Country Number he takes one of the 16 Countrys

Each Country has several cases for the Citys like -> Country A has 3 Citys = 3 Cases

Depending on which case he took for the City it will read the right file with the Streetnames and ZIP Codes.


DO you think this will work or there is any easier way to handle this "random logic"?

cause its a lot of work even its repeating non stop and i need to create for every case a random variable number cause every country has different amount of citys


example:

Country A has 5 Citys

Country B has 3 Citys

Country C has 12 Citys

and so on

if i do it like i mentioned i need to create for every random number a variable to get a random number from the city to get a random city.


Can someone follow me to this point and has any advices how i can make it more easier to handle and make it less work of scripting :)


thanks for reading and understanding :)


TurboGolom
2017/09/12 00:20:31
no one with an idea :( ?
kabone76
2017/10/17 10:51:58
Use a variable operate action to choose a random number. Use a switch to check what that random number is, then do a case based on the number. So for instance if you have 16 choice do a number from 1-16. If it choose 4 then make case 4 for what ever country. Take the same logic then in the case 4 - add in one more random from 1-5 to choose a random city 1-5. This would depend on inputting all data. There are many ways you can do this within botchief.
<< < 1> >>
VerifyCode
Advanced Option