Combinations of mixed races

As a DM I want to build immersive and memorable, but also logically coherent world. So I have question about races.

What are the rules for mixing the races?

For example, Is it possible to be half elf half gnome(elf and gnome parents) ? Can I mix everything with everything or not and why?

If so, what are the rules for racial traits? I want to know because I can use it to create some unusual NPCs, so racial traits are needed.

What element would Genasi children of mixed element parentage have?

Two of the players in my campaign are Genasi, who are expecting a child. I’m doing research into Genasi’s for this new side plot. Although I’m not sure what element(s) they would have.

One parent is a water genasi, while the other is an air genasi. So would the child have both air and water, only one, or some combination of both?

I’ve researched but I haven’t been able to find a solid answer, most I’m getting is linked back to para and quasi-genasi, but that doesn’t answer the question either.

Any information would be useful and very helpful.

I’m running a 5th Edition campaign, that uses older lore as well as current lore.

How to count near duplicates in a mixed pool using AnyDice?

Following on from this question: How to count duplicates in a mixed pool using AnyDice?

I’m also interested in the much harder question of using AnyDice to look at how much easier some dice mitigation of +/-1 makes getting duplicates (as per the example in that question).

For example, if I rolled 12, 12, 5, 4, 3, 1 the result of how many dice there are that are 1 away from a duplicate would be 3; because 5, 4 and 3 are all 1 away from another result.

How to count duplicates and near duplicates in a mixed pool using AnyDice?

The following question provides a function that answers the question for a single kind of die; How do I count the number of duplicates in anydice?

I want to count how many duplicates there are in a mixed pool such as 3d12, 2d10, 1d8.

For example, if I rolled 12, 12, 3, 3, 3, 1 the result would be 5; because 5 of the dice have at least one other die that has rolled the same value.

I’m also interested in looking at how much easier some dice mitigation of +/-1 makes getting duplicates. This is probably a much harder question.

For example, if I rolled 12, 12, 5, 4, 3, 1 the result of how many dice there are that are 1 away from a duplicate would be 3; because 5, 4 and 3 are all 1 away from another result.

AnyDice — efficiency of code calculating rolls hitting a target with mixed pools; hitting the 5 second barrier

I have some code that is hitting the 5 second barrier;

function: target N:n of A:s B:s C:s {     result: [count {1..N, 1..(N/2)} in [sort {A, B, C}]] } output [target 7 of 4d12 0d20 0d8] output [target 7 of 4d12 2d20 0d8] output [target 7 of 4d12 4d20 0d8] 

Even if I remove the final output line, it still fails.

I believe the code does what I want it to – calculate the number of dice rolling at or under the target from mixed pools (it runs when using other pools: d20s seem to be a problem).

Is there anyway I can improve it so that at least the first two of these output lines will run (or better yet, all three of them)?

N.b. from my perspective these were some of the simplest pools I wanted to look at.

AnyDice: Second highest roll from mixed pool

I’m struggling to adapt Ilmari Karonen’s answers from these two questions to my problem.

I want to look at the second highest value from various pools.

function: max A:n B:n C:n {     result: 2@[sort {A, B, C}] } output [max 1d12 1d10 1d8] 

Produces possibly believable results, but:

output [max 2d12 0d10 0d8] 

Is not at all believable, and completely disagrees with:

output 2@2d12 

Similarly testing with

function: maxs A:n {     result: 2@[sort {A}] } output [maxs 2d12] 

hasn’t helped.

How is Challenge Rating (CR) calculated for a mixed group of multiple monsters in regards to the Treasure Table?

I understand that encounters are balanced around exp thresholds in the DMG (e.g. https://rpg.stackexchange.com/a/105360).

With that said, there are loot tables in the DMG 136-139 that have “Challenge Rating” ranges for how loot should be distributed.

I understand CR is not supposed to be summed or multiplied, but if the party kills 20 CR 3 monsters, in the loot table, what would the challenge rating range be for these monetary loots?

As a tangential note: the DMG item loot tables don’t really explain which table to use “A vs B vs J, vs K…”.