Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pseudorandom directory tree generation?

I'm trying to write a program which will pseudorandomly autogenerate (based on a seed value so I can re-run the same test more than once) a growing directory structure consisting of files. (this is to stress test a source control database installation)

I was wondering if any of you were aware of something similar to the quasirandom "space-filling" sequences (e.g. van der Corput sequences or Halton sequences) that might work here.

edit: Or a fractal algorithm. This sounds suspiciously like a fractal algorithm.


edit 2: Never mind, I think I figured out the obvious solution, start with an empty tree, and just use sequential outputs of a pseudorandom generator to deterministically (based on the generated number and the state of the tree generated so far) do one of N actions, e.g. make a new subdirectory, add a new file, rename a file, delete a file, etc.

I want to do it this way rather than just sequentially dump files into a folder structure, because we're running into a situation where we are having some problems with large #s of files, and are not sure exactly what the cause is. (tree depth, # of renames, # of deletes, etc.)

It's not just 1 fixed tree I need to generate, the use strategy is: grow the tree structure a little bit, evaluate some performance statistics, grow the tree structure a little more, evaluate some performance statistics, etc.

like image 490
Jason S Avatar asked Feb 05 '09 19:02

Jason S


People also ask

How are pseudorandom numbers generated?

Pseudorandom numbers are generated by deterministic algorithms. They are "random" in the sense that, on average, they pass statistical tests regarding their distribution and correlation. They differ from true random numbers in that they are generated by an algorithm, rather than a truly random process.

What is the best pseudo-random number generator?

The Mersenne Twister is one of the most extensively tested random number generators in existence.

Why do we use a pseudorandom number rather than a truly random number generator?

Software-generated random numbers only are pseudorandom. They are not truly random because the computer uses an algorithm based on a distribution, and are not secure because they rely on deterministic, predictable algorithms.

What is trng and PRNG?

TYPES OF RANDOM NUMBERS AND GENERATION. METHODS. Random number can be generated in various ways, usually with PRNG and TRNG. The difference between PRNG and TRNG is deterministic, PRNG is a deterministic random number generator, and TRNG is a non-deterministic random number generator.


1 Answers

If this is just for testing, what is wrong with some simple, naive generation algorithm? Like, generate a random (1-10) amount of subdirectories, generate names for them, then for each directory recursively generate subdirectories and some amount of files.

This is easily customizable and you can control the seed for rand. For funkier needs, the distribution of the amounts of files/directories can be non-linear, but something that suits your needs more.

Sounds something that can be whipped up in half an hour and get done with. I fail to see a need for something mathemathical or complex. Unless this is just for fun, of course :-)

like image 95
Eli Bendersky Avatar answered Sep 22 '22 11:09

Eli Bendersky