Truly random numbers can be generated from
https://pypi.python.org/pypi/quantumrandom/
pip install quantumrandom
Currently you are limited to blocks of 1024 but with a bit of simple programming and a little bit of time you will be able to extend this limit to a large enough sample for most applications.
Answer from Alexander McFarlane on Stack OverflowCan I generate authentic random number with python? - Stack Overflow
Random Number Generation with Conditional Ranges
Start with hard coded numbers, say [1,10,20,30,40,50]. Add to each a random offset picked in the range [-4,+5] ([0,+4] for the first). Not quite random but then given all your conditions, how random can this be?
More on reddit.comWhat is random.radint in python?
Google is very good you know. https://docs.python.org/3/library/random.html
More on reddit.comPython and random.randint - why isn't it random?
Videos
Truly random numbers can be generated from
https://pypi.python.org/pypi/quantumrandom/
pip install quantumrandom
Currently you are limited to blocks of 1024 but with a bit of simple programming and a little bit of time you will be able to extend this limit to a large enough sample for most applications.
The documentation for the random module has this to say:
Warning: The pseudo-random generators of this module should not be used for security purposes. Use
os.urandom()orSystemRandomif you require a cryptographically secure pseudo-random number generator.
Hi Community,
Let's say I have numbers from range 1 to 55 and I have to choose 6 numbers at random from this range. The 6 random numbers must to be unique, non-repetitive and need to be put into a list (let's say in ascending order).
Each random number has equal probability of getting picked.
However, the lower numbers have least chances of appearing in the higher number range in the list and the higher numbers have least chances of appearing in the lower number range in the list. For example, numbers 1 or 2 cannot appear in the 5th or 6th position in the list and similarly numbers 54 or 55 cannot appear in the 1st or 2nd positions in the list.
The sum of the 6 random numbers must be between 100 and 200.
How will I be able to generate random numbers with such constraints?
Of course, I have already checked this module:
random.sample()
And I'm also able to generate random numbers with their sums between 100 and 200 using conditional loops... But I'm struggling with the low/high probability part of the above constraints.
Any ideas or help here is appreciated.
Thanks!
Start with hard coded numbers, say [1,10,20,30,40,50]. Add to each a random offset picked in the range [-4,+5] ([0,+4] for the first). Not quite random but then given all your conditions, how random can this be?
-
Generate a random number
-
Check if it's valid for the current position
-
Repeat if not