I am working on a pet project to make a random file, i.e.
dd if=/dev/urandom in Rust. Since the file size is only known in runtime, I have been thinking about using array as buffer and count the number time the buffer has been filled and do some special processing on the last buffer. @upsuper suggested a mmap based approach. However, since
unsafe, I am not entirely comfortable to tango with it.
What is the idiomatic way to generate a file of a given size?