"Simulation Modeling and Analysis", 2nd Edition by Law and Kelton.

If you need something specific - I have the book at hand.

Example:

Bernoulli (p.472)

-----------------

1. Generate U~U(0,1)

2. If U <= p return X = 1. Otherwise return X = 0.

Uniform distribution can be obtained by the C library rand() function.