How dos a random variable $X$ is connected with the set over which is uniformly distributed? I have a silly question, tough not obvious to me. Most times we see in probability theory many of the definitions or theorems start with the following quotation: ``Let $X$ be a random variable that is uniformly distributed over $G$..." How are these two connected. Namely, how the variable is connected to the set $G$? Is it through the pdf of $G$ or does this have to do with the support or the domain of the random variable of $X$?
 A: As noted in the comments, "$X$ is uniformly distributed over $G$" means that $P(X\in I) \propto m(I)$ for some measure $m$ for and $\forall I \in \sigma(G)$ (the "sigma field" generated by $G$).
If $G \subset \mathbb{R}$ then $m$ is usually the Lebesgue measure and the measurable subsets are defined as the Borel sigma algebra $\mathcal{B}(\mathbb{R})$ (it's the sigma algebra defined by all the open sets of $G$)
For example, if $G = [0,1]$ then our "measurable sets" are the unions and intersections and complements of all the open subsets on $[0,1]$ (which basically includes all the sets one would care about, like $[0,0.5), [.1,.2], $etc.
The associated measure is the Lebesgue measure, which is boils down to the total length of the set for simple 1-d intervals like $(a,b)$
$$\text{Leb}([a,b]) = b-a$$
Technical point
A random variable is formally a function from an abstract probability space to a measurable space (usually some subset of the real numbers or integers):
$$X: \Omega \to W,\text{ where }S:=\left(\Omega, \mathcal{S}, \mathbb{P}\right), V:= \left(W,\mathcal{W}\right)$$
Unless one is doing theoretical work, we often "forget" about $S$ and just work with $V$ and the "induced probability measure" $\mathbb{P}_X := \mathbb{P}\left(X^{-1}(B)\right), \forall B \in \mathcal{W}$, which together forms another probability space:
$$V':=\left(W,\mathcal{W}, \mathbb{P}_X\right)$$
When we say "X is uniformly distributed over G" we are basically specifying $V'$ directly (i.e., instead of trying to derive from some underlying probability space that we don't really care about).
In this case, we don't really end up thinking of $X$ as a function anymore, but as the outcome of an experiment, where $V'$ is the probability space and $W=G$ is the sample space it is defined on.
I never understood why we teach Prob. 101 students the whole "RV as function" rule as its utility is very limited in non-theoretical contexts and often confuses more than helps (at least did so with me).
