Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 4
    if you have floats instead of ints, you may want to replace b == b.max() with np.isclose(b, b.max()) Commented Oct 7, 2019 at 22:15
  • arr.max() can be replaced by np.max(arr) for clarity that numpy array is involved Commented May 29, 2021 at 11:23
  • roughly three times slower! Commented Sep 25, 2021 at 11:48
  • For better performance you could try max(enumerate(b), key=lambda key: (key[1], rng.random()))[0] Commented Nov 26, 2022 at 4:17