# Creating Random Number Generator with range

I've been trying to create my own random number library(in java). I've searched for randomization and Blum Blum Shub algorithm looks good. It needs a start value, it is not actually random. So i get unix timestamp mod(10) for first value. Now i can generate random numbers. My question is; how can i modify my structure with range? I mean, i want to generate that numbers in a range. (I don't want to use java's another classes or functions) Any advices? Thanks in advance.

EDİT:I coded $\ x(n+1)= x(n)^2mod(M) \\$ formula and gived x(0) unix timestamp's last digit and M=191. So i get random numbers with Blum Blum Shub. But i want to get that numbers in a range. It is not about my code. It is about the formula and method actually.

• start value + (random number%(end value - start value)) This May work for your case – Deep Joshi Mar 21 '17 at 12:12
• If start=0 end=25 and unix digit=3, result will be 3. If unix=5 result=0... It mostly will return small digits. I need something like Blum Blum Shub and i'm looking a way for make it with range. – Furkan Ayık Mar 21 '17 at 12:29
• – D.W. Mar 21 '17 at 15:38
• Raw links don't help nearly so much as a simple explanation of why to visit the link. – SDsolar Mar 23 '17 at 7:42
• Hi everyone. I changed my structure and i didn't use blum blum shub. I just use timestamp MOD(range) for range. My question was not so clear i think and i'm sorry for that and i'll work on subject again. But thank you all for time and help. – Furkan Ayık Mar 23 '17 at 10:19