math.random() follows which algorithms

前端 未结 5 1534
盖世英雄少女心
盖世英雄少女心 2021-01-03 03:47

Am using math.random() method to generate random numbers. but i had a doubt about that method. math.random() is which algorithms will fallow to generate random

5条回答
  •  -上瘾入骨i
    2021-01-03 04:38

    Here are 2 methods to Shuffle an Array:

    Approach 1: Shuffle elements in an array

    Approach 2: Java Collection.shuffle() method

    And the method you use is one standard way accomplishing this.

    There are 2 ways in java: java.util.Random and java.lang.Math.random. java.lang.Math.random() uses java.util.Random. It provides only doubles and has no seeding capability.

提交回复
热议问题