Eden Generation

This is a technical analysis of how the game randomly generates the various characteristics of the Eden character. Note that this analysis was performed by BLouBLue on version 1.05 (pre-Afterbirth), and version 1.06.T1 (Afterbirth+).

Launch
When launching the game, the main thing to know is the game will derive a bunch of subseeds that will be used by RNG instances dedicated to items, trinkets, pickups, enemies, level generation and character management.

This allows you to play your run slightly differently, yet still, get the same items at the same place (for the most part - that's not entirely true).

One specific "character" subseed is used for Eden generation. This RNG instance is used during two phases:


 * 1) Generate hearts, pickups, and attributes, before level initialization;
 * 2) Randomly pick cards, pills, trinkets, and items, after level initialization.

It is reset to the character subseed before either phase. This means the same random numbers could come out of the RNG in the same order for both phases.

Hearts
Hearts are the first thing to be generated. The game tries its best to give you 3 full hearts, Red and Soul hearts altogether:


 * 1) The game randomly picks   Red Hearts;
 * 2) It will randomly pick between   Soul Hearts;
 * 3) If no red hearts were picked at the first step, the game guarantees the player at least 2 Soul Hearts.

There cannot be any Black Hearts from this phase. Collectible items given afterward may exceed those limits.

Keys, Bombs, and Coins
Eden has a 1/3 chance to start with either keys, bombs or coins. If you've been granted that chance, here are the possible outcomes:


 * 1) Eden starts with 1 key;
 * 2) Eden starts with 1 or 2 bombs;
 * 3) Eden starts with 1 to 5 coins.

Collectible active/passive items given afterward may give additional pickups, bringing the total beyond those limits.

The chance to start with a pickup is calculated as follows:

Attributes
Attributes are based on Isaac's base attributes. An additive modifier (float value) is randomly chosen for each of the 6 attributes:

Here's what the attribute initialization part of the routine looks like:

Pocket Items
Pills, cards, trinkets, and items are picked after level generation. Two phases occur:


 * 1) Give the player a chance to have either a pill, card or trinket;
 * 2) Attempt to pick 1 active item and 1 passive item.

So, when consuming an Eden token, you have:
 * 1/3 chance to get a trinket;
 * 1/6 chance to get a pill;
 * 1/6 chance to get a card;
 * 1/3 chance to get none of the above.

These options are mutually exclusive. You cannot get a trinket and a card or pill. Here's what the actual routine looks like:

More about how pocket items of each type are selected:
 * Pill colors and pill effects are shuffled based on a subseed derived from the main seed. 9 or 13 pill effects are selected and randomly assigned to each of the flavors. If entitled to, Eden will randomly get one of those pills;
 * Trinkets are randomly chosen among the unlocked trinket pool. There are 32 random repicks, or 64 repicks in Afterbirth+, and another pass if unsuccessful. The game may give up if the player hasn't unlocked any trinket;
 * Eden cannot start with the following cards/runes:
 * Any rune,
 * 2 of Clubs, 2 of Diamonds, 2 of Spades, 2 of Hearts, Joker,
 * Ace of Clubs, Ace of Diamonds, Ace of Spaces, Ace of Hearts;
 * 2 sets of cards are created:
 * A special card set containing:
 * Chaos Card, Credit Card, Rules Card, A Card Against Humanity and Suicide King,
 * Get out of Jail Free Card, ? Card, Dice Shard, Emergency Contact
 * Holy Card, Huge Growth, Ancient Recall, Era Walk
 * A global set containing every other card except those that are forbidden,
 * Eden has a 1/25 chance to randomly get a card from the special set, and a 24/25 chance to get one from the global set.

Here's how the card selection is done, in pseudo-code:

Collectibles
The game does 100 attempts to fill both the active item slot and one passive item slot. At each attempt, it will randomly pick an item ID between 1 and 346 or 552).

There are a few disabled item IDs which cause the game to repick a random ID and go on to the next attempt:
 * #43: "Pills here!", an active item that does nothing and looks like a pill.
 * #59: "Tarot Card", a passive item that looks like a card and does nothing.
 * #61: Literally nothing, and is not defined in items.xml.
 * #235: Not Available
 * #238:
 * #239:
 * #263: Not Available
 * #550: (piece #1)
 * #551: (piece #2)
 * #552:

The first valid candidate (unlocked item) for the passive or active slot is selected, and will not be overwritten by subsequent attempts (there will be 101 attempts no matter what).

The player is given those items after 100 attempts, whether both slots are filled or not.

Therefore, Eden may start with up to 1 active item and up to 1 passive item. It is highly unlikely that a seed exists which gives Eden only 1 or no item.

As nothing weighs some items specifically, it means each item combo probably has about a 0.005% chance of being your reward. Testing material: 1000 Eden seeds

C# Code
Code for calculating Eden's items for a given seed. This is missing trinket, pill and stats calculations.

The full code can be found here Blade's GitHub Gist.