Wild Magic effects take a die as input ("spell dice") which is rolled as 1d(spell dice) + 1d8 + 1.
The resulting number provides the listed effect as follows:
1-3 : Teleport with range 10.
4-6 : Teleport with range 100.
7-8 : Teleport with range 200.
9-11 : Darkness with radius 10.
12-14 : Lights area.
15 : Destroys the next door the caster touches.
16-17 : Randomly removes nearby walls.
18 : Causes your melee attacks to have a chance to put monsters to sleep.
19-20 : Creates traps in adjacent squares and under you.
21-22 : Creates doors in adjacent squares.
23-25 : Alerts and hastes all nearby monsters.
26 : Earthquake with radius 5.
27-28 : Gain a random mutation.
29-30 : Disenchants your gear as if you took disenchantment damage.
32 : Player-centered ball which does (spell dice + 5) chaos damage in 1 + (spell dice / 10) radius.
33 : Creates walls of stone in all adjacent squares.
34-35 : Summons 8 monsters or groups of monsters as friendly pets with level = dungeon level * 3 / 2.
36-37 : Summons a powerful monster as a pet.
38 : Summons a cyberdemon as a pet.
Otherwise, procs the Ancient Foul Curse effect.