Get the latest tech news

Making Python Less Random


Using ptrace to intercept and modify a process's getrandom syscall.

At this point, I should have pulled the code I was using out of that library, and refactored my game so that all sources of randomness came from some kind of pseudorandom generator function (e.g., random.Random). Instead, I thought about the different ways to alter the functionality here without making any code changes, and took a detour to catch and modify syscalls to getrandom. My unrandom program didn't print anything initially, it let all the non-getrandom syscalls through to the kernel, and back, without interference.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of python

python

Photo of Random

Random

Related news:

News photo

Ultra simplified "MNIST" in 60 lines of Python with NumPy

News photo

Pyxel: A retro game engine for Python

News photo

Show HN: Maelstrom – A Hermetic, Clustered Test Runner for Python and Rust