TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Use Inclusive Ranges for PRNGs

2 pointsby chilipepperhottabout 2 months ago

1 comment

TrayKnotsabout 2 months ago
Interesting point. But I usually prefer `(lower..upper).choose()`. So, if I want it inclusive, I can simply do `(lower..=upper).choose()`. No downcasting required. And perfectly obvious behaviour thanks to a known API.