I have to write a code for generating random numbers without using random module and its function.
How do I do it? I tried using the system time as it keeps on changing (importing milli seconds) but with tht I am able to get random nos in the range of thousand only.

I have to write a code for generating random numbers without using random module and its function.
How do I do it? I tried using the system time as it keeps on changing (importing milli seconds) but with tht I am able to get random nos in the range of thousand only.

The general formula for LCG is X_{n+1} = \left( a X_n + c \right)~~\bmod~~m . The recommended value for a, m, c are given in Wikipedia page. It is recommended use those combinations of a, m, c for more randomness. Start with any value of X and for different random numbers everytime you run code choose X using system time.

To get number in particular range, eg [L, H) apply this to every random number generated(say Y) : Z = L + Y%(H-L)

The general formula for LCG is X_{n+1} = \left( a X_n + c \right)~~\bmod~~m . The recommended value for a, m, c are given in Wikipedia page. It is recommended use those combinations of a, m, c for more randomness. Start with any value of X and for different random numbers everytime you run code choose X using system time.

To get number in particular range, eg [L, H) apply this to every random number generated(say Y) : Z = L + Y%(H-L)

I tried using this formula. It works fine for small nos (not exactly small but upto 1000000000) After that it starts giving L at the end of the no. How do I increase its range?

You mean output sort of this 132434454545435435L .

Well this happens when the number gets greater than usual integer type range. Python converts normal integer into Long type and Python shows L after long types. When you do print num , L doesnt shows up.

You mean output sort of this 132434454545435435L .

Well this happens when the number gets greater than usual integer type range. Python converts normal integer into Long type and Python shows L after long types. When you do print num , L doesnt shows up.

print num means? Could you please tell the syntax. I want to print a list of nos.

The general formula for LCG is X_{n+1} = \left( a X_n + c \right)~~\bmod~~m . The recommended value for a, m, c are given in Wikipedia page. It is recommended use those combinations of a, m, c for more randomness. Start with any value of X and for different random numbers everytime you run code choose X using system time.

To get number in particular range, eg [L, H) apply this to every random number generated(say Y) : Z = L + Y%(H-L)

Probably the best inputs is date/time, used memory, random user input, and my favorite mouse movement(truecrypt uses this).

Right now i have used time for my input. Could you please give a bit more info on used memory and mouse movement?

Fetching memory usage and mouse input are OS dependent. There isn't a library to fetch memory usage, but you can use the "mem" command on windows to fetch it, and the "ps" or "free" command on UNIX to fetch it, but keep in mind you might need to use a little regex or at least some string functions. For mouse input you can use pyHook for windows, and xlib for UNIX(OS X supports X11, and any Unix distro worth using supports it).

If you need me to I can post some examples of pyHook, xlib, and memory fetching.

Write a program that displays all numbers divisible by 3 and 4 within a range entered by user. Display five numbers per line. Numbers are separated by exactly two spaces. ...

Hi guys. I am trying to create a program where the user inputs an integer and the program will cout the nth prime number. Unfortunatly when I try to cout ...

Hello Friends,
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...