Java Random nextFloat() MethodThe nextFloat() method of Random class returns the next pseudorandom, uniformly distributed float value between 0.0 and 1.0 from the random number generator's sequence. SyntaxParametersNA Return ValueThe nextFloat() method returns the next pseudorandom float number between 0.0 and 1.0. Example 1Test it NowOutput: Random Float value : 0.25081772 Random Float value : 0.52181274 Example 2Test it NowOutput: Enter number of students.5 Enter name of 5 students. 1 Payal 2 Anshu 3 Baby 4 Mona 5 Jugnoo 1. Payal's id : 0.14586294 2. Anshu's id : 0.78586906 3. Baby's id : 0.76507455 4. Mona's id : 0.9362442 5. Jugnoo's id : 0.5890219
Next TopicJava Random
|