Random generation of integers number with some specific characteristics

Issue

This Content is from Stack Overflow. Question asked by silent_hunter

I am trying to generate random integer values in the chi-squared distribution. Below you can see my code.

import numpy as np
import matplotlib.pyplot as plt
import random

# Using chisquare() method
gfg = np.random.chisquare(3, 1000)

df_chi = pd.DataFrame(gfg, columns = ['Column_A'])

df_chi.describe()
count, bins, ignored = plt.hist(gfg, 14, density = True)
plt.show()

This code generates random values in the chi-square distribution. Now I want to create random values in the chi-square distribution but some specific characteristics, such as:

Number of rows: 100000
Minimum values: 0
Maximum values: 99999999
Mean: 30000
Standard deviation: 500000

Can anybody help me how to do this?



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?