0
Python Modules Are Made By Normal Humans or by Official persons of python company/language?
i heard that we can create a module in python, But Python Have a module name random👀 you can use this to do random things, But How random library/module work? means how they generate Random Number without using random module? This question is not just for Random Module;
5 Respuestas
+ 5
"Python Modules Are Made By Normal Humans or by Official persons of python company/language?"
they are made by corporate aliens.
+ 4
Everyone who has written a module is a "normal human". What else would they be? And to find out about random in python, find out how they do it in C.
+ 3
Well, pseudo random number generator algorithm is used to generate very long list of random numbers, and then when you run your random function the numbers are taken from that list.
More on pseudo random number generator algorithms:
https://en.wikipedia.org/wiki/Pseudorandom_number_generator
+ 2
While this isn't the place for an in-depth explanation (stackoverflow is typically better for this), it has to do with a certain algorithm that can produce a series of seemingly random numbers from a set seed value. This seed value is typically the system clock, or some other input that has a somewhat inherently random characteristic. I suggest looking up Pseudo-random Number Generators and the specifics for how they work.
That said, it seems that you're talking about the modules themselves. Well, anyone can write a module for python, though most of the standard ones were written by programmers that work on python. All you have to really do is create a new .py file, and start writing some code into it, then import it inside another file, and voila. Though if you want to be pythonic about it, you have to include the:
if __name__ == 'main':
#code if the current module is the main module
at the bottom of your module, otherwise the interpreter won't know if you're using the module as the main program, or as an imported module. After that, use import or from ? import ? statement in other files to use it.
+ 2
Mask Man(What's in a Name?) Would you be considered abnormal by yourself, if you somehow create a module which later becomes a modification to the 'random' module? Nope I guess.