Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

With PDF, you can in principle have a different random order every time you open the PDF.


Interesting point! I wonder how that fits in to PDF/A and the idea that an archival format and long-term preservation of the original document...


It’s not possible with PDF/A, which prohibits both JavaScript and PostScript in PDF. (These are the only ways I can think of obtaining a random number in PDF.)


Please do link an example of PDF randomness...


PDF lets you run JavaScript (if the PDF viewer doesn’t block it), including on opening a document. Math.random() is available in that environment. JavaScript in PDF allows you to switch the visibility of layers on and off, or to fill the values of text fields. PDF forms sometimes use this to generate likely-unique IDs. Alternatively, PDFs can have embedded PostScript to render contents. PostScript has a random-number function rand built-in. (PostScript support is deprecated in PDF 2.0.)


There's a pseudo random number generator in Doom, there must be some randomness somewhere in here. https://doompdf.pages.dev/doom.pdf




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: