I was recently asked how to check the entropy of a given section in YARA, and because the person who asked is clearly looking to learn how to fish instead of just being given fish I went into some detail on the explanation. With his permission I am sharing my response here.
It's a combination of a number of things:
math.in_range(test, lower, upper):
Given a test value, check to see if it is in range of the lower and upper bounds. This is an inclusive test.