I recently did some research and statistics-gathering (with DFHack) on what causes sedimentary layers in DF, and made some interesting discoveries:
world.world_data.geo_biomes[].unk1 is an "enum" for the type of layers as follows:
0 NORMAL
1 VOLCANIC
2 DEEP OCEAN
3 DEEP OCEAN VOLCANIC
4 SHALLOW OCEAN
5 SHALLOW OCEAN VOLCANIC
6 SAND DESERT
7 SAND DESERT VOLCANIC
- NORMAL geo-biomes are the default for land areas. You get several random soil layers. This is followed by a sedimentary (~80% chance), metamorphic (~10%), or intrusive (~10%) layer. The remaining layers below are metamorphic (~50%), or intrusive (~50%), except that the bottom-most layer above the magma sea is always intrusive.
- VOLCANIC geo-biomes are like normal, except that the first stone layer under the soil is always extrusive, and the random subsurface layers are ~33% each of extrusive, intrusive, and metamorphic. Volcanic geo-biomes occur when the volcanism of the biome is over 90 on a scale from 0-100.
- DEEP OCEAN geo-biomes have a few layers from the ocean soils subset, then a layer of a deep ocean sedimentary (or extrusive if volcanic), then random layers as per normal (or volcanic). Deep ocean geo-biomes occur in oceans of elevation 0-49.
- SHALLOW OCEAN geo-biomes have a single sand layer, then a layer of a shallow ocean sedimentary (or extrusive if volcanic), then random layers as per normal (or volcanic). Shallow ocean geo-biomes occur in oceans of elevation 50-99.
- SAND DESERT geo-biomes are rare, as they only occur in sand desert biomes. They are like normal (or volcanic) biomes, except that there is always a single layer of a sand instead of several soil layers.
As far as I can tell, the chance of getting a particular layer stone is otherwise purely random. There does not appear to be any evidence of other logic/code which determines the type of layer stone in a biome.