This is not the most general situation. The most general definition of a random variable replaces the function f with an object known as a probability measure, but we shall not attempt to use this.