vendredi 4 août 2023

How to create a function that generate a random number but following a specific distribution

I like to create data visualizations, but I often need to generate data, and i find the random normal distribution too "boring".

I would like to create a generator of random values that follows a specified distribution.

My idea is to use a graph editor such as:

https://observablehq.com/d/ac77643d0cd9422e

From this editor i have a function distribution(x) that return the y value on the graph.

And i would like to create a distributor(distribution) function that return a random value, but the value has more "chance" to be a x if the y on the graph is high.

I have no idea how to achieve that.

Does someone have any idea how I can proceed?

Thanks




Aucun commentaire:

Enregistrer un commentaire