# Are there any algorithm to generate a set of data that match some statistic requirements?

I was wondering if there are time-efficient algorithms that can reverse the process of basic statistics computation. What I mean is an algorithm that instead of computing the mean, SD, max-min range, median... based on input values, would do the inverse operation, i.e generating a set of data with the required/wanted statistical results. What seems the most optimal way to solve such problems ? Thought about genetical algorithms, but maybe are there better ways.

If you want to know why I'm searching to do this : I'm a student in sport science field and my project is about generating an AI that would detect when people fake their data to proove their point. I want to know what would be the best algorithms to fake such results, so maybe I could detect people already doing that. Thanks !

I think the general concept you're describing is sampling from a distribution. If the distribution in question is known and has nice properties, there are typically closed-form equations for doing the sampling based on generating uniform random numbers. For example, if I want to generate numbers that fit a normal distribution with mean $$\mu$$ and standard deviation $$\sigma$$, I can use the Box-Muller Transform.
• If you just need to sample from a Gaussian, you don't even need to implement something like Box-Muller yourself. Most programming languages have a library function that handles it for you. In Python, you could use numpy.random.normal(x, y) for example to generate samples from a distribution with mean=x and std=y. Box-Muller is how you might implement such a function yourself, but you shouldn't have to. Dec 9, 2022 at 20:58