Hey Sup Forums you know that meme where we call Sup Forums a "chinese cartoons imageboard" or "norwegian goat herding forum" or whatever
i made a program that randomly generates names
it generates lists from the three txt files (they have to be in the directory with the executable, you can change them, line limit of 50 characters), then just throws them together.
> github.com/JaxonSkye/chan.git Three .txt modifiable dictionaries, the source code, and an already compiled executable. What do you think?
this was completely necessary and i applaud you for your effort
David Johnson
I wrote this same thing like two years ago
I'm glad someone else on a Libyan Mountain-biking forum had this idea
Ian Harris
>Cambodian Neurosurgery Fraternity Good work, user.
Jordan Brown
>Coptic AMD Onion Node cyberpunk af
Tyler Baker
>not making it deep learn the meme for infinite lulz at least it was a fun 5 min programming exercise that you could post on a mongolian basketweaving bbs
Liam Reed
>>not making it deep learn the meme for infinite lulz
are you legitimately 15 years old
David Garcia
>French Canadian roleplaying microbrewery lol
Ayden Gomez
so he could crawl a guatemalan beekeeping forum for instances of the meme, record what actual anons post, and use that to weight the probabilities of the words it chooses?
Jace Gutierrez
is called an croat hand waxing tabloid you mongoloids
Alexander Baker
more than double that lol xDDD
sure, hoping it would learn that the formula was akin to [ethnicity|group] [activity|industry|thing] [social messaging medium] or however complex it is
Camden Brown
actually this is the Sudanese stormchasing subsection
Kayden Price
woah the things you learn on an alaskan moosemeat blackmarket documentary
Brody Sanders
I thought this was a Mongolian Croat-waxing tabloid.
Ryder Evans
Good work OP. Also nice korbo
Jace Mitchell
>using C it's a one-liner in python
Landon Brooks
well that's just no fun
Christopher Ortiz
how... how did you learn to program such complicated algorithms?! are you some kind of genius???
Levi Sanders
>What do you think?
>unused includes >global variables >global variables passed as arguments with the same name >constants are neither const nor #defines >all caps identifiers that are not #defines >inconsistent placement of asterisks in pointer definitions I think you have lots of work to do.
Jace Turner
not op here, rate my python version
import random
f0 = "adjectives.txt" f1 = "actions.txt" f2 = "areas.txt"
for i in range(0,3): with open(filename[i]) as infile: list[i] = infile.readlines() list[i] = [x.strip() for x in list[i]]
numGen = input("Generate how many names? ") print "Generating ", numGen, "names."
for j in range(0,numGen): for i in range(0,3): listNum[i] = random.randrange(0,len(list[i])) assert (0
Hudson Harris
why do you have three other repositories that are basically empty?
public class thing{ public static void main(String[] args){ System.out.println ("This is a string."); } }
Luis Green
>on Sup Forums >over 30
Alexander Wilson
>you don't need listOne-Three use [[]] * 3 instead >if you want extra variables for each filename is debatable >why is there an assert? >you don't need a list for listNum if you just use it in the same block
Austin Smith
Good, now make a shit post generator.
Mason Diaz
damn that helps a lot, thanks the extra variables for the filenames was in to make it clearer in case you changed filenames manually, but I guess its still clear without that anyway the assert was because I havent used the random range generator before and I didnt trust it
how does this look now?
import random
filename = ["adjectives.txt","actions.txt","areas.txt"] list = [[]]*3
for i in range(0,3): with open(filename[i]) as infile: list[i] = infile.readlines() list[i] = [x.strip() for x in list[i]]
numGen = input("Generate how many names? ") print "Generating", numGen, "names."
for j in range(0,numGen): for i in range(0,3): listNum = random.randrange(0,len(list[i])) print list[i][listNum], print
includes spaces around the input number automatically? is it just a feature? I would have imagined it wouldnt do that
Daniel Cook
Looks pretty gud! You can take a look at random.choice() which would make the code a bit tidier and then maybe reduce the inner loop with a list comprehension
Carson Thomas
got it down to this:
import random
filename = ["adjectives.txt","actions.txt","areas.txt"] list = [[]]*3
for i in range(0,3): with open(filename[i]) as infile: list[i] = infile.readlines() list[i] = [x.strip() for x in list[i]]
numGen = input("Generate how many names? ") print "Generating", numGen, "names."
for j in range(0,numGen): for i in range(0,3): print random.choice(list[i]), print
I'm not understanding how list comprehension can reduce it further though
is this the type of thing you meant by list comprehension? p = [random.choice(list[i]) for i in range(0,3)] print p,
Connor Walker
not the one you answer to but probably meant replacing
for i in range(0,3): print random.choice(list[i]), print
with
print ' '.join(random.choice(list[i]) for i in range(0,3))
some other notes as it seems you're coming from another lang
you can do range(x) instead of range(0,x) you can use a for loop over a list of items you don't have to initiate the list, you can append don't use list as variable name (it is also the name of a built-in function) use dict instead of list for immutable such as the filename list
Grayson Bell
thanks friend, I'll look into working those in too I do electrical engineering and the most we ever realistically use is a small amount of matlab but I've been trying to expand a bit by myself as a side hobby
Seriously though this is something I've always struggled with.
LINE_LEN is hard coded. And that's fine if the OP write all the .txt files and knows the smallest safe value. But what happens when someone adds a 60 character adjective?
All these memes about "safe" C involve reading the right amount of characters but there's no sane way to make this code work when it's not assigned to one variable.
How would you make this extensible?
Luke Taylor
can you give me a small idiots rundown on why urandom might be better than rand()?
is it just safer?
Julian Anderson
because this is such a security-critical application, right? We wouldn't want random numbers that might be statistically random but not cryptographically secure on our Argentinian origami forum.
Nathan Barnes
You're supposed to use alliteration and something that vaguely describes visual art, you flaming faggots.
Chinese cartoons Taiwanese tapestry Cantonese cave paintings Etc
Mason Lee
But you can do this in google spreadsheet.
Austin Long
>complaining about improper usage of memes on a Kuwaiti Badminton website
Liam Sullivan
>dict meant tuple
Thomas Perry
Your shtty code doesn't compile properly, just prints out the contents of one of the files
output = [] for f in filenames: with open(f, 'r') as input_file: w = random.choice([x.strip() for x in input_file.readlines()]) output.append(w)
output = ' '.join(output) pyperclip.copy(output)
print output
copies the string to clipboard for maximum shitposting efficiency
Jason Williams
>Serbian AMD repository
Connor Wood
sorry friendo
Jacob Turner
Make a site, faggot. It's not that hard.
William Parker
>paying money so that a total of 6 people can shitpost more
Henry Murphy
>Japanese Thinkpad Forum /tpg/... I...
Mason Richardson
Basque Tie Knitting Community French Canadian NEET Culture Sorority Filippine Contrabass Enthusiasts Board Chinese Dog Breeding Deep Web Drug Marketplace Basque Astrology Subreddit
Evan Adams
Please don't play with our naturally occurring memes and shitposting. This is Reddit shit.
Daniel Sanders
Gonna make a website out of this and put lots of ads on it thanks OP
Jason Kelly
I've heard Ukrainian Bear-skinning Forum before
Nicholas Edwards
Finally, someone with gumption.
Daniel Hill
...
Michael Martinez
I wanted something that could run without depending on anything else being installed Yeah kinda just threw things together until it worked If you decide the hidden message in the names of the repos, moot appears and turns you into a little girl I think tumblr can make a free site with this/basically this on it, but I don't really want to mess with tumblr that much
Kevin Baker
>not already having a server and domain sure is summer in here
Jaxson Phillips
>2017 >posting babbys first code on a coptic amd onion node