Hmmm i think you should do this tutorial first but i'll try to help you.
First you need to create a button, then add a script and put this inside
In the ready function you connect the pressed state with the _random function.
randomize() change the seed which will generate the random number.
And the last line set the button text with a random number from 0 to 10.
Hope it helps!