In my thesis, can I use results for which a collaborator wrote most of the simulation code, or do I have to independently replicate the simulations?
If those results are published, cite the publication. If those results are unpublished, you can cite the contribution of the other student either where you present the results ("Otherguy and Vladhagen, unpublished, 2015") or in an acknowledgment (I would favor the latter). Your advisor should be able to answer questions like this as you write your dissertation as well.

Note that in academic work, "writing code" is not held to the same level as intellectual input: it's good that you want you make sure your colleague gets appropriate credit, but it just isn't the same as developing ideas. The same would go for other "grunt work" in a lab: culturing the cells, washing the dishes, running the PCR. That type of credit goes in the "acknowledgments" section, or with some added intellectual work and help drafting the manuscript, they get a middle authorship. Science is a collaborative process, and no one expects your work in your dissertation to be yours and yours alone without anyone's help. 

If you want to distribute the code itself, you would want to have permission of the person writing the code.