Full Width [alt+shift+f] Shortcuts [alt+shift+k]
Sign Up [alt+shift+s] Log In [alt+shift+l]
1

Secure Random Numbers in Node.js

from Boot.dev Blog [alt+shift+b] in programming

Quick answer: use crypto.randomBytes() for cryptographically secure randomness in Node.js. const { randomBytes } = await import("node:crypto"); const buf = randomBytes(256); console.log(`${buf.length} bytes of random data: ${buf.toString("hex")}`); crypto.randomBytes() is a cryptographically secure random number generator based on openssl. Depending on the operating system of the user, randomBytes will use /dev/urandom (Unix) or CryptoGenRandom (Windows).
3rd Jul 2019

Stay updated

Get a weekly newsletter with the top 5 articles worth reading every week.

More from Boot.dev Blog

WannaCry: The Ransomware Attack That Shut Down Hospitals

It was 3 PM on a Friday. A doctor at an NHS hospital in the UK tries to check his email. Instead, one of the PCs in the room reboots into a scary red screen demanding $300 in Bitcoin [23].

2nd Jun 2026 • 1 votes
The AI Land Grab Looks Familiar

In May of 2013, Yahoo announced plans to buy Tumblr for 1.1 billion dollars. Yahoo’s CEO, Marissa Mayer, stood in front of the press and said, “We promise not to screw it up”.

11th May 2026 • 1 votes
Gitignore Patterns: What to Ignore and Why

Many devs adopt the git add . (yolo, just yeet it all into the commit) workflow. It is fast, simple, and usually correct. But eventually you’ll have files in your repo directory that should never be committed: secrets, generated artifacts, dependency folders, and random local junk. That’s what .gitignore is for.

1st Apr 2026 • 1 votes
Python Functions: How to Define and Call Them

Functions allow you to reuse and organize code. Instead of copying and pasting the same logic everywhere, you define it once and call it whenever you need it. They’re the most important tool for writing DRY code.

1st Mar 2026 • 1 votes
The Boot.dev Beat. February 2026

A new year and another record broken! In January a combined 4,016,641 lessons and challenges were completed by you, dear pupils! And to top it off, we’re now releasing the much anticipated Power BI Course by none other than Alex the Analyst! I hope you enjoy it.

11th Feb 2026 • 1 votes

More in programming

Not everybody is an AI expert - and that’s fine

This post was previously published through my newsletter on November 9, 2026. From time to time, I will republish newsletter issues on my blog here if I think people (and search engines) might benefit from it. If you want to read everything I’ve written once it is posted, I recommend signing up for the newsletter. If you’re doing anything to stay on top of what is happening in the world of software testing and test automation, like browsing or even posting on LinkedIn, which I stopped doing for the foreseeable future, or reading blog posts - my preferred way of keeping up these days, and I highly recommend Dawid Dylowicz’s excellent Software Testing Weekly aggregator mailing list if you prefer longer-form reading, too you’d be thinking that AI has consumed our entire field, and that everybody (or at least those who post or write in public) is an AI expert these days. The reality, though, is far from that. Yes, some people use a lot of AI, even when I would only call a small fraction of them ‘experts’. I definitely do not classify myself as an ‘AI expert’, by the way. A much larger group uses AI on a less frequent basis, and they’re getting some value out of it. Sometimes more, sometimes less. That’s the group I’m probably in. And then there’s a group of people who haven’t really been using a lot of AI at all so far, beyond maybe the odd prompt to ChatGPT or Claude. I don’t have the actual numbers, but I suspect that this group is a lot larger than you would think from browsing your feed or surfing the blogosphere. You just don’t see them, because they’re typically not the people who do a lot of work in public. A few weeks ago, I started working with a small group of testers to teach them how to use AI in their daily work. This work covers both test automation as well as broader software testing tasks, as some of them contribute to automation on a daily basis, but not all of them do. I’m working with them one day per week, on average, for three months, and we’re making small steps towards making AI a more prominent tool in their tool belt. So, what are we working on right now? I’m pulling ideas from my ‘Valuable Feedback, Fast with AI’ course, and so far, we’ve spent some time setting up Claude, going over some important concepts such as context windows, models, tokens, and (of course!) the probabilistic nature of LLMs, and what that means for the results they provide. We have gone through several initial conversations, using Claude to learn more about and review specific user stories, which was an excellent segue into using talking about MCPs and setting up a connection to both Jira and Confluence using the Atlassian MCP. Last week, we also started experimenting with writing straightforward skills to make it easier for Claude to repeat certain actions in a structured way. These actions ranged from reviewing stories and acceptance criteria to refactoring small chunks of code in their (Robot Framework-based) test automation suite. What I loved about this is the avalanche of ideas that popped up in their heads when they saw how easy it was to use Claude. We made a short to-do list of ideas to try out for the next couple of weeks, and I’m looking forward to seeing them getting more confident around using Claude. One thing I have noticed is that their level of comfort around using AI varies quite a bit. Some of them are naturally quite cautious, which means they’ll ask ‘can we really do this?’ and ‘should we really do this?’ frequently before even submitting a single prompt. This is a good habit, I think, but we’ll have to do some work to get them more comfortable with using LLMs, without losing too much of that caution. Others in the group are the opposite: I need to hold them back a little, because otherwise they’ll create a beautiful mess within days, simply because they see so many opportunities to use Claude in their work. That, too, isn’t inherently bad, but I do want to teach them not just how to get the most out of an LLM, but also (more so) how to use AI prudently. Over the next couple of months, we’ll dive deeper into writing better prompts, creating and structuring skills, better context management, and creating and using agents, and probably a few more things, too. I’m looking forward to seeing these people grow more comfortable around using AI in their daily work, and figuring out where AI genuinely adds value and where it doesn’t in their own context. Is there a deeper message in this newsletter? Maybe not, and I’m just happy to tell you about this project, and how it is a great example of a what I call ‘corporate mentoring’, a very efficient way of teaching a small group of engineers new skills, within their own context. But maybe it’s also to show you that, despite what you might see on the Internet, especially those places featuring a lot of self-congratulation (I’m looking at you, LinkedIn), not everybody out there is an AI expert. At least not yet. So, if you feel like you’re ‘behind’ simply because you’re not running at least 17 agents continuously, creating 5400 merge requests per day, know that you’re not alone. Quite far from it, I would say.

22 hours ago • 1 votes
Notes from CoRL 2026

(Tuesday)

2 days ago • 1 votes
The Codebase Rewrite is Back

The economics of software engineering have fundamentally changed.

2 days ago • 1 votes
How OCaml effects simplified my JSON interpreter

How effect handlers removed control-flow plumbing from query-json

2 days ago • 1 votes
Unattended reboots with encrypted disks

An introduction to ZKeys: a new service that stores encryption keys off-site and automatically locks access to them if the client machines go offline for a long period of time.

5 days ago • 1 votes
📚 BoredReading

You seem to be enjoying this.

Join free to unlock everything.

Create free account

Already have an account? Sign in