Q:

How would I go about satisfying conditions for the Gaussian distribution?

I need a PDF $ f(x) $ to satisfy two conditions. That is, for a given value $B$, the conditions
$$ \int_0^1 f(x)dx = 1-B $$
and 
$$ \int_0^\infty f(x)dx = 1$$
applies.
The purpose of this distribution is to generate random integers (using $ \left \lfloor{x}\right \rfloor $) from 0 to infinity, with $ E[x] $ being $B$. 
I think I need to use a Gaussian distribution, but I don't know how I'd do this. I know I need to integrate the Gaussian function from 0 to infinity (since I'm not using negative values) and normalise it, but everything I've tried has led me nowhere.

Edit to add details about the actual problem:
I have been assigned to write some code for an astronomy research group at my university for the summer (mostly in Python). One of the assignments I've been given is to write a program that generates an image with a level of background noise and one peak source, to simulate an image of an X ray cluster. The value $B$ is the expected value for a pixel due to the background noise in the image; typically in real images this is of the order of 0.05 (so most pixels have a value of 0, roughly one in twenty have a value of 1, although in theory the value could be very high, hence me needing a more complex distribution).
The code will take an input for $B$ and create random noise on the image from this value. 
The reason that I need integers is because the data that the group uses comes from an X ray telescope, so the pixel values on the real images will be integers, because that is the number of X ray photons that the telescope detected in that location during the exposure time, which will be quantized. 
I have tried using a Gaussian distribution simply because it best approximates what I want; I have also looked into the binomial and Maxwell-Boltzmann distributions, so if they work as well or better than the Gaussian for this situation, then I'm open to suggestions, but I could not see how they would be more applicable.

A:

The notion of using some continuous variate on $(0,\infty)$ and discretizing it, or indeed of using the Gaussian distribution is not directly relevant to your problem.
To get a discrete variate with exactly these properties:
$$P(X=0)=1-B$$
$$E(X)=B$$
that also fits your description in the edit (which implies $P(X=1)=B$) the only possibility is a Bernoulli distribution with parameter $B$.
However, I'd strongly suggest you consider Bridgeburner's suggestion of a Poisson distribution with parameter $B$ even though it only approximately fits your conditions --
With $B=1/20$ you'd have:
$P(X=0) = 0.95123\:$  (which is not $1-B$ exactly)
$P(X=1) = 0.04756$
$P(X=2) = 0.00119$
$P(X>2) = 0.00002$ 
and has expected value $1/20$. The Poisson would be a common (even standard) choice for background noise of the kind you would appear to actually need.

