In your question, transmitter output is two level NRZ signal. For generating the data bits based on uniform random distribution, you may use the follwing command:
bits = (randi([0 1],1,100)).'
The above command will generate the bit sequence of 1s and 0s with random distribution of equal probabilty of 1 and 0.
To convert these data bits into NRZ line coding please refer to the following file exchange :
This file contains a function unrz which is for unipolar NRZ signal. For your question you can modify the code. Under else condition, assign the x value as -1.
The above submission is one of the several submissions in MATLAB File Exchange on MATLAB Central which is a forum for our product users to interact, exchange information and knowledge, without MathWorks' involvement. Feel free to contact the author of this submission directly for specific questions about the implementation".