Random Actuator change "int_max" via Python
Without knowing the error it's hard to guess, but I think it's caused by a syntax error in the last line. If you don't set a value for Rand.int_max, python won't execute this script. To get detailed information about the error, you can open the Blender Console (Window &gt; Toggle System Console).

So instead of Rand.int_max = write Rand.int_max = [some integer].

But, you can't set int_max directly via BGE Python. Instead you have to use a call to Rand.setIntUniform(lower_bound, upper_bound)(API). lower_bound is int_min, upper_bound int_max.

A few other things you could improve:


Timers are actually floats, but Rand.setIntUniform() requires an Integer, so put the timer value into int().
Instead of else: if Dif == 0: you can write elif Dif == 0: (or just else: if Dif is never negative).
If you only need the logic module and no other bge modules, you can delete the first line, you only need the second line (from bge import logic as l).
Variable names in python are in snake_case by convention, so don't call your variables Dif or Rand, call them dif or rand instead. But this is a matter of taste, your code is working the same regardless of the naming conventions. The Blender API calls (like getCurrentController() are in CamelCase because Blender is written in C and C++ and these languages use CamelCase.
If you want to activate (= execute) the Random Actuator after setting the value, add cont.activate(rand)(API) to your script. Other than the other Controller types, a Python Controller doesn't execute all connected Actuators by default.


So here is a version of your code that should work:

from bge import logic as l

cont = l.getCurrentController()
own = cont.owner

dif = own['DIF']
timer = int((19 - (dif * 3))) # Convert the result to int
rand = cont.actuators['Random']

if cont.sensors['Always'].positive and dif != 0:
    rand.setIntUniform(0, timer)

# just 'else' if dif can't be negative
elif dif == 0:
    rand.setIntUniform(0, 0)

# If you want to execute the Actuator
cont.activate(rand)