Python Forum
Scaling random numbers within specific range - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Scaling random numbers within specific range (/thread-22065.html)



Scaling random numbers within specific range - schniefen - Oct-28-2019

How would one scale some random numbers within a specific range in Python, say [0,pi]? Would simply fmod(random_number/pi) do it?


RE: Scaling random numbers within specific range - ichabod801 - Oct-28-2019

If you have random numbers on a range (0, 1), multiplying them by n puts them on a range from (0, n).


RE: Scaling random numbers within specific range - schniefen - Oct-28-2019

Say the random numbers are not explicitly given, i.e. we don't know in which interval they're in. How would one work around that?


RE: Scaling random numbers within specific range - ichabod801 - Oct-28-2019

Generate a bunch of them and estimate the interval?


RE: Scaling random numbers within specific range - jefsummers - Oct-28-2019

Depends on the application. Can you get all the random numbers into a list and then see the min and max? I take it you are not generating the random numbers but receiving them for analysis?