I am converting some c code to python. I am wondering that is there any drand48() equivalent in python(exactly the same!) or a wrapper to it?
Thanks a lot
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are looking for
random.random.It does not use the same generator as
drand48. Thedrand48family uses a 48-bit linear congruential generator, whereas the Python random module uses the superior Mersenne Twister algorithm.If you want the exact same output as
drand48, you can implement it in Python.However, the output will be significantly inferior to Python’s standard random number generator. The
rand48family of functions were declared obsolete in 1989 by SVID 3.