Generating Random Numbers is quite simple. Just use the class Random and method nextInt as :
new Random().nextInt(10);
This will generate a unique random number between 0 and 9 (both inclusive). Similarly if you want to generate a unique random number between a fixed length, say 10 to 100, use can use a code something like [...]
Archive for the ‘Codes’ Category
Java Code for generating Unique Random Numbers
Java code for shuffling
Many times we are required to shuffle a particular set of objects so that they may mix up properly. A standard way to shuffle any set of objects is to swap their positions randomly. The code given below does this by swapping the position of all the numbers of the array. The code uses the [...]
C Code for Quick Sort
Writing programs for sorting of a given set of numbers is one of the common programming tasks. Various types of sorting techniques like selection sort, inserting sort and quick sort are quite popular. Here C code for Quick sort is being presented. Here, in each iteration the array is subdivided into 2 arrays, and hence [...]
C Code for Bubble Sort
Searching and sorting have been popular operations in elementry data structures. Although now a days many advanced sorting techniques are used to sort a set of data, the basic sorting methods are still popular and are the used frequently. Here C code for bubble sort is given. The algorithm for bubble sort is quite simple. [...]
C Code for Selection Sort
Searching and sorting have been popular operations in elementry data structures. Although now a days many advanced sorting techniques are used to sort a set of data, the basic sorting methods are still popular and are the used frequently. Here C code for selection sort is given. The algorithm for selection sort is quite simple. [...]

Posted in
Tags: 
