Your desired mean is given by equation:
$\frac{N\cdot p - N \cdot (1-p)}{N} = .05$
from which follows that the probability of the 1s
should be .525
In Python:
x = np.random.choice([-1,1], size=int(1e6), replace = True, p = [.475, .525])
Proof:
x.mean()
0.050742000000000002
1'000 experiments with 1'000'000 samples of 1s and -1s:
For the sake of completeness (hat tip to @Elvis ):
import scipy.stats as st
x = 2*st.binom(1, .525).rvs(1000000) - 1
x.mean()
0.053859999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
And finally drawing from uniform distribution, as suggested by @Łukasz Deryło (also, in Python):
u = st.uniform(0,1).rvs(1000000)
x = 2*(u<.525) -1
x.mean()
0.049585999999999998
1'000 experiments with 1'000'000 samples of 1s and -1s:
All the three look virtually identical!
EDIT
Couple of lines on Central limit theorem and the spread of resulting distributions.
First of all, the draws of means indeed follow Normal Distribution.
Second, @Elvis in his comment to this answer did some nice calculations on the exact spread of the means drawn over 1'000 experiments (circa (0.048;0.052)), 95% confidence interval.
And these are results of the simulations, to confirm his results:
mn = []
for _ in range(1000):
mn.append((2*st.binom(1, .525).rvs(1000000) - 1).mean())
np.percentile(mn, [2.5,97.5])
array([ 0.0480773, 0.0518703])