Java Program to Generate Random Numbers using Middle Square Method

This is java program to generate the random numbers. In mathematics, the middle-square method is a method of generating ‘pseudorandom’ numbers.To generate a sequence of 4-digit pseudorandom numbers, a 4-digit starting value is created and squared, producing an 8-digit number (if the result is less than 8 digits, leading zeroes are added to compensate). The … Read more

advertisement

Java Program to Implement Linear Congruential Method for Generating Pseudo Random Number

This is java program to generate a random numbers, using linear congruential generator. The formula for next random number in the sequence is x(n+1) = {a*x(n)+c}mod m, where x(n+1) is current number to generate, x(n) is previously generated, a is multiplier, c is additive term and m is modulus. Here is the source code of … Read more

advertisement

Java Program to Implement Gauss Seidel Method

This is java program to find the solution to the linear equations of any number of variables. The class provides a simple implementation of the Gauss-Seidel method. If the matrix isn’t diagonally dominant the program tries to convert it(if possible) by rearranging the rows. Here is the source code of the Java Program to Implement … Read more

advertisement

Java Program to Implement Gauss Jordan Elimination

This is java program to find the solution to the linear equations of any number of variables using the method of Gauss-Jordan algorithm. Here is the source code of the Java Program to Implement Gauss Jordan Elimination. The Java program is successfully compiled and run on a Windows system. The program output is also shown … Read more

advertisement

Java Program to Implement Fisher-Yates Algorithm

This is java implementation of the Fisher–Yates shuffle (named after Ronald Fisher and Frank Yates)algorithm, also known as the Knuth shuffle (after Donald Knuth), for generating a random permutation of a finite set—in plain terms, for randomly shuffling the set. Here is the source code of the Java Program to Implement Fisher-Yates Algorithm for Array … Read more

advertisement

Java Program to Emulate N Dice Roller

This is the java program for emulating N dice roller. This can be achieved using random numbers. User can also select how many dice in a game. Here is the source code of the Java Program to Emulate N Dice Roller. The Java program is successfully compiled and run on a Windows system. The program … Read more

advertisement

Java Program to Compute Discrete Fourier Transform Coefficients

This is the java implementation of calculating coefficients of the given function performing the Discrete-Fourier Transform. Formula for calculating the coefficient is X(k) = Sum(x(n)*cos(2*PI*k*n/N) – iSum(x(n)*sin(2*PI*k*n/N)) over 0 to N-1 Here is the source code of the Java Program to Compute DFT Coefficients Directly. The Java program is successfully compiled and run on a … Read more

advertisement

Java Program to Implement Coppersmith Freivald’s Algorithm

This is the java implementation of classic Coppersmith-Freivalds’ algorithm to check whether the multiplication of matrix A and B equals the given matrix C. It does it by checking A*(B*r)-(C*r) where r is any random column vector consisting only 0/1 as its elements. If this value is zero algorithm prints Yes, No otherwise. Here is … Read more

advertisement

Java Program to Perform Complex Number Multiplication

This is the java implementation of multiplication of two matrices consisting of complex numbers. Complex numbers are of the form a+bi. Here is the source code of the Java Program to Perform Complex Number Multiplication. The Java program is successfully compiled and run on a Windows system. The program output is also shown below. //This … Read more

advertisement

Java Program to Implement the Bin Packing Algorithm

This is the java implementation of classic Bin-Packing algorithm. In the bin packing problem, objects of different volumes must be packed into a finite number of bins or containers each of volume V in a way that minimizes the number of bins used. In computational complexity theory, it is a combinatorial NP-hard problem. Here is … Read more

advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.