Not so Random Numbers

In cryptography or science in general, you often need perfect random numbers. Well, up to today, that was my need as well. However, today I was trying to generate numbers that are not too random, but have a certain bias. I think it’s kind of ironic. Googling for a solution is almost impossible. Every link shows a perfect random number generator ;)

I don’t care what the bias is in the numbers that are generated. Actually, the bias can be pretty high. Anyone have a method to do this in Perl?

Can you do something like int(rand($upperLimit*1000)) % 1000 ??? Basically changing the interval from where the random number is taken and then shrinking it again?

Postings on this site don't necessarily represent Arcsight's positions, strategies or opinions. Raffael Marty manages the solutions team at ArcSight, the global leader in Enterprise Security Management. Raffy’s information security expertise includes log management, intrusion detection, insider threat, regulatory compliance and security data visualization. He will be writing a series of guest posts for Security Blog.

For more on Raffael's work, Read his blog here.