It's a bit complex, but the teams with the worst records have greater odds than teams that just missed qualifying for the postseason.
For instance, the New Jersey Devils had the third worst regular-season record but had a 11.5 percent chance of winning the lottery for the No. 1 pick. Montreal missed the playoffs by a single spot and went into the lottery with a 1 percent chance of rising to the top pick. After the top three picks are randomly determined by lottery balls, the order for No. 4-15 reverts to the teams with the worst records claiming the higher picks.
Here's how NHL.com explains how the remaining 16 teams who qualify for the playoffs are ordered:
"Non-division winning teams eliminated in the first two rounds of the playoffs are seeded in inverse order of regular-season points, followed by the four division winners. The Nashville Predators, the division winner with the fewest points, have the No. 24 pick, followed by the Washington Capitals, Calgary Flames and Tampa Bay Lightning.
The No. 28 pick will go to the Carolina Hurricanes, who lost to the Boston Bruins in the Eastern Conference Final. The No. 29 pick belongs to the Buffalo Sabres, who acquired it from the San Jose Sharks as part of the trade for forward Evander Kane on Feb. 26, 2018. The Hurricanes slot one spot ahead in the draft order because they had two fewer points (99) during the regular season than the Sharks.
The Bruins, who lost the Stanley Cup Final, will pick No. 30, and the No. 31 selection is assigned to Stanley Cup champion St. Louis Blues."
But, hold on, the Blues first-rounder goes to Buffalo, which received the pick as part of a trade deal in exchange for center Ryan O'Reilly.
Some draft-pick trades do work out for teams. O'Reilly was named most valuable player for the Stanley Cup Playoffs.