Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to create a RNG with specific "constants" and "equations"

r(1=< r < 0)

X^n+1 = (aX^n + b) mod m
r = X^n+1/m

-To get maximal length of period use = m = 2^k, k >= 0
- a = 5
- b = 1
-Depending on the size of m, define; x, m, a, b as long (maximum of X: 5*2^k-1)

" ^ " = indicates that characters after it are subscripted in first 2 equations, in the other equations it define upperscripts.

What I have tried:

Hey there folks,

I've a request from you, I'm having "Introduction to Java Programming" lecture, and I got an assignment, which is totally unsolvable to me right now.

I'm asking for your help to understand this "constants" "equations" and how to apply them to the code.

I'm so appreciate to everyone who try to help, in advance.

with all my respects.
Posted
Updated 14-May-16 21:14pm
Comments
Patrice T 14-May-16 14:39pm    
Having a good understanding of mathematics is an essential skill for a programmer. But we can't teach it to you.
Try to manually use these mathematics to generate your 'random sequence'. Once you can do it on paper, the way you do it should be pretty close to what you need to program.
Member 12523652 14-May-16 16:16pm    
Thank you for your advise, but I think I had a bad decision of taking this lecture.. Since I'm not into Math that much.
at least I'm going to give it a try, apparently I need to grind in a library for a while :)
Cheers!

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900