0

I am trying to generate 1000 values with landau distribution with an MPV(most probable value) of 25, can't find a landau random number generator in scipy or numpy. I tried pylandau {pip install pylandau} but this seems to only fit landaus and not generate random numbers. Any way of doing this would be welcome in python or pyroot.

1 Answers1

0

The package pylandau is just calculating the Landau function value. It can be used for fitting, random number generation, etc. It seems like you would like to know how to generate random numbers from a distribution, as answered in another question here. The following example creates 100 random values from the Landau distribution:


import numpy as np
import pylandau

x = np.arange(-1, 1, 0.01)
y = pylandau.landau(x)
random_values = np.random.choice(x, size=100, p=y / y.sum())
DavidLP
  • 11
  • 3