Good to see you here!
Okay...
It makes a lot more sense for me to advise you than code it for you, since a) I'm hella short on time and b) then you'll know how for next time.
If you've never done functions before, the code is as follows.
function function_name () {}
Inputs into the function are in the round brackets, those create a kind of local variable for use within the function, which you have to put in when you call the function. The curly brackets are what the function does. The function keyword declares that this is a new function.
So for a button to call a function, have the button with onclick="function_name();" as a property. If you have any input variables, they need to go in the round brackets, for example if you're inputting a number it should be function_name(3); or whatever. However, in your case I think you probably want to get your numerical input from a text box, and you can "grab" that via the Document Object Model (you give the textbox a name="boxname" attribute, then
inputnum = encodeURIComponent(document.getElementById("boxname").value);
Will make a variable with your value in it. It's not all that neat, but it works. Another handy tip is that when you're grabbing numbers, multiply them by one before doing anything else; this checks/forces Javascript to see it as a number variable, since there's not actually any differentiation when creating the variables.
I'm assuming you know the HTML side of this, but correct me if I'm wrong. THhe above should let you get started; your start button needs to generate a random number and store it in a global variable (in other words, you need to create the storage variable
outside your function). Then make a textbox, give it a name, make a second button that grabs your value from the textbox, tests if it's equal to the first stored value, then if it is adds to a "wins" variable and possibly also makes a little popup box to tell them that. Once you've got that sorted
Other useful functions:
Math.random() creates a random number between 0 and 1
+ - * / for add, take, times, divide
Math.round(a number) rounds it up to the nearest whole
Math.floor(a number) rounds it down to the nearest whole
You can nest functions, so Math.round(Math.random) will always give a value of 1. Math.round(Math.random()*10) will give a random number from 1 to 10, and so on.
Hope that helps as a starting point.