Challenge #1: What does this relevance do? (answer provided)

This relevance takes a provided integer ?? and returns a different integer as a result.

What does this relevance do? I’m looking for what the integer represents that is returned.

(if (it = 2) then /* It is Complicated */ 0 else ( if (it < 8) then (30 + it mod 2) else (30 + (it + 1) mod 2 ) ) ) of ??

Hint: Try some numbers, like 0 through 20 in the debugger. Not all results from all numbers matter for this particular use case.


Click here to see the answer

The integer values for ?? is the number of the month of the year. The result of the relevance is the number of days in that month. February is not handled due to it being a complicated case.


Correct answers:

I’m not going to list any more correct answer submissions because I’m going to provide the answer collapsed above.


Other Challenges:

5 Likes

Hint: Try some numbers 1 through 20 in the debugger. Not all results from all numbers matter for this particular use case.

I’m a bit torn about giving the answer here. I’ll have to think about that, but definitely message me directly through the forum if you are interested in the answer.

Also, I have some ideas for the next challenge.

Would you consider putting the answer in a spoiler? Like this?

Click me to spoil the fun

Answer to question!

1 Like

Oh, I like that. I think that is a great option.

The answer is now available in the post.

Challenge #2: Challenge #2: Provide equivalent relevance using different inspector

What does “mod” actually do?

mod is the name of the modulus operator, which returns the remainder in a division operation.

Take a number like 6, divide it by 2, the result is 3 with 0 remaining after the division (2 x 3 + 0 = 6). So, 6 mod 2 returns 0.

Or, take another number like 7, divide it by 3, the result is 2 but with a remainder of 1 (2 x 3 + 1 = 7). So, 7 mod 3 returns 1.

It is most often used in relevance to test whether some integer is even (n mod 2 = 0) or odd (n mod 2 = 1) or to create a sampling of target systems for action deployment, for example, computer id mod 5 = 0 to target approximately one in five or 20% of the population of computers. (Note that the computer id assigned to a BigFix client is not truly random, but it is close enough.)

2 Likes

Thank you! (This was my introduction to “modulus”!)

1 Like