I have a random number generated in a computer programme which produce values from 1 to 100. I want to map this range in order to comply with the following rules $$ \begin{align} \text{number }&100\text{ should be mapped to }100\\ \text{number }&50\text{ should be mapped to } 0\\ \text{number }&0\text{ should be mapped to }-100\\ \end{align} $$
I am interested to know how to do this transformation (is that even the right word?) It is a long time since I did any mathematics. More formally, calling $t$ the sought for mapping,
$$ \begin{align} t(100) &= 100\\ t(50) &= 0\\ t(0) &= -100 \end{align} $$
It looks like you want a function: some operations that take a value in, and after those operations are applied, return another value.
All these points pass through a line since the slope is the same. For example, using the points $(0,-100)$ and $(50,0)$, the slope is $\frac{y_2-y_1}{x_2-x_1} = \frac{0-(-100)}{50-0} = 2$. You can verify that $(50,0)$ and $(100,0)$ return the same slope.
The standard form of a line is $y=mx+c$. $y$ is the $y$-value which is the same as the output value, $m$ is the slope, and $c$ is the $y$-intercept (where the line intersects the $y$-axis).
We have already found the slope is $2$. Now substituting any pair of $(x,y)$ into $y=mx+c$, we have $(0)=2(50)+c$, so $c=-100$.
Therefore the function you need is $y = 2x-100$.