I am trying to create an array of random numbers using the Numpy random exponential distribution. This works fine for me, however, I have one additional requirement for my project, and this is the ability to specify exactly how many elements of the array have a certain value.
Let me explain (the code below, but I will talk about it here): I generate my random exponential distribution and build a histogram of the data, creating a good exponential curve. What I really want to do is use a variable to indicate the y-intercept of this curve (the point where the curve corresponds to the y axis). I can achieve this in the main way by changing the number of bins in my histogram, but this only changes the graph, not the original data.
I pasted the bones of my code here. To give some context, I'm trying to create an exponential disk from the galaxy, so the random array I want to generate is an array of radii, and the variable I want to specify is the number density at the center of the galaxy
import numpy as N import matplotlib.pyplot as P n = 1000 scale_radius = 2 central_surface_density = 100
This code creates the following histogram:

So, to summarize, I would like to indicate where this graph captures the y axis, controlling how I generated the data, and not changing how the histogram was built.
Any help or requests for further clarification would be greatly appreciated.
source share