Dice adventure in the river Styx You're sitting in the school cafeteria, microwaving your food like you always do around lunch. Suddenly the programming devil rises from the ashes of your burnt food and proposes a challenge:


  Sup guys, I have a challenge.


How did this happen? What did you ever do wrong? Was it that one bad macro in C?

The programming devil demands a game of dice:


  I demand a game of dice.


Strictly speaking, it is not a game of dice. The programming devil just wants you to calculate the mean value of throwing a die n times. The programming devil's twist is that the die can, and always will, have a number of  faces larger than n.

Challenge:

Write a program which calculates and outputs the mean value of n throws with a die with a number of faces greater than n.

Input:

Two positive integers. The first argument determines the number of throws, the second argument the number of faces of the die. There is no empty input - always two integers.

Output:

The mean value of throwing the dice n times rounded to the closest integer.

Requirements:


No output if the number of faces of the die is less than or equal to the number of throws.
The values returned from throwing the die has to be random (as close as we can get to random, that is)


The programming devil thinks this is great and will restore the burnt food of the programmer which writes the shortest code in bytes to solve his challenge:


  This is a great challenge. I will restore your food if you propose the shortest program in bytes to me.
Ostrich 0.7.0, 18 23 chars

Two solutions, identical in length:

:x;.,{;xR*C}%_+*\/o2/+F
\:x{.R*C\}*;]_+*x/o2/+F


Edit: +5 characters to each because I forgot to round to the nearest integer.

They both actually simulate rolling the dice (and thus have non-constant output), which seems to be the intent of the challenge.

Explanation of #1:

:x;     store the number of faces in x, pop from stack
.,      create range from 0 to [number of rolls] (while keeping #rolls on stack)
{...}%  map over that range...
  ;       discard the number
  xR*     generate a float between 0 and [number of faces]
  C       take ceil, which will make this an int between 1 and [#faces]
_+*     reduce by {+} (_ is the syntax for a single-instruction block) a.k.a. sum
\/      swap top two stack elements (bringing the number of rolls to the top),
          then divide, resulting in the average


Explanation of #2:

\       bring the number of rolls to the top
:x      store number of rolls in x, but don't pop from the stack
{...}*  that many times...
  .       duplicate the number of faces
  R*C     get the random number as described in #1
  \       stick that under the number of faces again, so [#faces] is still on top
;       discard the extra [#faces]
]_+*    wrap stack in an array, sum
x/      divide by [#rolls]