Readit News logoReadit News
aalhour commented on The German Works Council has blocked Amazon's performance reviews    · Posted by u/jerrryyy
Adept-Hermanus · 2 months ago
Just fine. Worker's Councils have a voice in what is measured and how it is measured and they usually find a reasonable formula with management. Without knowing the details, I am going to assume Amazon was being invasive, draconian and exploitative in their approach.
aalhour · a month ago
I worked as a manager at a local German company in Germany with a strong Worker's Council team. Performance Management was run through them, they had comments, the process was adapted and managers were onboarded. This is not to say that performance management doesn't suck in general (because once you start having metrics, people start gaming them and you're almost superimposing it on people's way of working), but the Worker's Council didn't block it, because at the end of the day it was neither invasive nor exploitative.

EDIT: typos.

aalhour commented on Ask HN: Memory-safe low level languages?    · Posted by u/hyperbrainer
90s_dev · 4 months ago
> Python

Funny you make that analogy. I remember back when the two contending C alternatives were Zig and Nim, with Nim being syntactically almost a Python clone.

It seems Nim has gone the way of Crystal (Ruby version of Nim) and is just kind of there but mostly forgotten and doomed to be abandoned unless it finds a niche.

> What sets Zig apart is compile-time

I see this claim a lot, but I'm not sure. I think it's the fact that Zig is more or less still C syntax and semantics, just... fixed. The way it does comptime does seem better than how other languages do it, but I haven't actually used it, much less for long enough to judge it properly.

aalhour · 4 months ago
I haven't used Nim but your comment made me remember that language, yeah it was forgotten but I am not sure if it's completely abandoned, it seems that their team has been launching new language releases on a nice cadence: https://nim-lang.org/blog.html
aalhour commented on Ask HN: How many times will this loop run on average?    · Posted by u/aalhour
hardlianotion · 2 years ago
I edited my response with an apology! Thanks for checking!
aalhour · 2 years ago
No worries, I think your solution coverges with @Someone's above, if I am not mistaken. You're multiplying the probabilities for all values of j up to i for all values of i.
aalhour commented on Ask HN: How many times will this loop run on average?    · Posted by u/aalhour
Someone · 2 years ago
In C (and your Python conversion), the i < Random(1, 100) part is evaluated each time through the loop, not once at start of the loop to determine the limit.

So, it’s 1% that the loop ends at i = 1, if it takes that hurdle 2% that it ends at i = 2, if it takes that hurdle 3% that it ends at i = 3, etc.

The calculation is easier if you phrase that this way:

It’s 99% that the loop continues at i = 1, if it takes that hurdle 98% of the rest that it continues at i = 2, if it takes that hurdle 97% that it continues at i = 3, etc.

So, the probability to make it past i = n is

  0,99 × 0,98 × 0,97 × … × (1 - n/100)
Note that this isn’t necessarily the case in all languages. Pascal, for example, has a real for loop where the limit is evaluated once and the index variable cannot be changed inside the loop, so that the compiler can determine the number of iterations before starting the first iteration.

aalhour · 2 years ago
I was aware that the Random function call gets evaluated in Python (and C) every time the loop iterates, I just couldn't imagine the probability distribution myself, I had assumed that all numbers are uniformally distributed but didn't cater for the sums. You're a legend! Now I see it. I wrote the following code to check out your argument and it checks out indeed :thumbs-up:

  def p(n):
    total = 1
    for i in range(1, n):
      total *= (100-i)/100
    return total


  for i in range(1, 100):
    print(f"p({i}) = {p(i)}")

The first 13 results:

  p(1) = 1
  p(2) = 0.99
  p(3) = 0.9702
  p(4) = 0.9410939999999999
  p(5) = 0.9034502399999998
  p(6) = 0.8582777279999998
  p(7) = 0.8067810643199997
  p(8) = 0.7503063898175998
  p(9) = 0.6902818786321918
  p(10) = 0.6281565095552946
  p(11) = 0.5653408585997651
  p(12) = 0.503153364153791
  p(13) = 0.44277496045533604
p(12) sits at 50%, of course it will be the mean! :D

aalhour commented on Ask HN: How many times will this loop run on average?    · Posted by u/aalhour
orbz · 2 years ago
You’re calculating a random number every time the loop runs. If you want an average of 50 you should call random outside the loop and save the value to be compared each time.
aalhour · 2 years ago
Yes, that's true. I don't want an average of 50. My initial guess of 50 is wrong. I am trying to understand why the average turned out to be approximately 12.
aalhour commented on Ask HN: How many times will this loop run on average?    · Posted by u/aalhour
hardlianotion · 2 years ago
Expected index given by

E [X] = \sum_{i \in [2,100)} p(X < i)\prod_{j < i}p (X \ge j)i.

Edit: Sorry rest of reply was wrong. Had to account for not hitting until i^th loop.

aalhour · 2 years ago
Not sure that adds up, I translated the right side of the equality into a Python statement and it returns a number I am not sure how to interpret:

  1/99 * sum([(i-1)*i for i in range(2, 100)])   # 3266.666666666667
Both the median and mean are around 12 for 10K runs of the loop.

aalhour commented on Ask HN: How do I get invite to Lobste.rs?    · Posted by u/adaboese
_benj · 2 years ago
I got you :-)
aalhour · 2 years ago
me too please?

u/aalhour

KarmaCake day286July 28, 2015
About
https://aalhour.com
View Original