Talk:Modified random distribution: Difference between revisions

From Rosetta Code
Content added Content deleted
(Python plots.)
 
(→‎Uploading images: new section)
 
Line 12: Line 12:
</lang>
</lang>
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 00:41, 26 February 2021 (UTC)
--[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 00:41, 26 February 2021 (UTC)

== Uploading images ==

''Output a textual histogram with from 11 to 21 bins showing the distribution of the random numbers generated''

Now that images can be uploaded, is it OK to provide one (or more) as part of a solution ? [[User:Laurence|Laurence]] ([[User talk:Laurence|talk]]) 22:45, 13 July 2023 (UTC)

Latest revision as of 22:45, 13 July 2023

Python plots

RC can only handle text, but the following appended to the Python solution produces pretty plots. <lang python>if __name__ == '__main__':

   import pandas as pd
   x, y = zip(*[(x / 1001, modifier(x / 1001)) for x in range(1001)])
   dfm = pd.DataFrame({'x': x, 'modifier(x)': y})
   dfm.plot.line(x='x', title='Probability Modifier')
   df = pd.DataFrame({'data': data})
   df.plot.hist(bins=21, title='Histogram of generated numbers')

</lang> --Paddy3118 (talk) 00:41, 26 February 2021 (UTC)

Uploading images

Output a textual histogram with from 11 to 21 bins showing the distribution of the random numbers generated

Now that images can be uploaded, is it OK to provide one (or more) as part of a solution ? Laurence (talk) 22:45, 13 July 2023 (UTC)