this post was submitted on 20 Nov 2023
1 points (100.0% liked)

Perchance - Create a Random Text Generator

0 readers
1 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

See this post for the Complete Guide to Posting Here on the Community!


Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

Have fun generating! ⚄︎

founded 1 year ago
MODERATORS
 

Hi!

I need a consumable list where two items are picked, but only the first is a random selection, and the second item is not at random but always a specific item based on the random first item.

Say, if item one is "A", then item two always has to be "X", and if item one is "B", then item two always has to be "Y".

To complicate things: "X" and "Y" should not be eligible for the random first item, they can only be the second, non-random item.

To complicate things further: none of the items are numbers, I'm sorry.

What I tried was to do something like a consumable list with dynamic odds, where I used == instead of != in mad hopes it'd work, but of course it didn't. (Is this something that could work if I changed it up a bit?)

A friend suggested I could use key/value pairs, but that would be so incredibly unwieldy and I'd rather not. I want to use this for long lists (plural) and for multiple possible outcomes. If key/value pairs are the most reasonable way to do this, how would I do this? Could I define the pairs in my list?

I'd really, really appreciate if someone could point me in the right direction.

Sorry if my question and/or explanation is confusing, I had too much coffee and I've been staring at code >24 hours now. Please let me know if I need to rephrase my question to make it make sense to people who are not in my brain.

Thank you!

(Not linking the generator in question because it's almost 3,000 lines of code and what I want to do is currently not in it anyway lol.)

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here