I don’t think any LLM would miss the use of Math.random where a cryptographic random should be used. Then again, I don’t think I know any programmers that would miss it. It’s not some advanced concept. It’s security 101 stuff.
I had code using math.random() to generate passwords introduced into my codebase, written by opus 4.6 in Febuary 2026, and not found until November 2026
Lots of old examples of code using Math.random() in the training data, probably more than Crypto.getRandomValue, given that Math.random has been around a lot longer.
You can try and train it out afterwards but there’ll always be a part of the model that wants to write everything with Math.random because so many people did in the past
Replies (1)
Replies (1)
You can try and train it out afterwards but there’ll always be a part of the model that wants to write everything with Math.random because so many people did in the past