Javascript Random Number?

前端 未结 3 1725
傲寒
傲寒 2020-12-16 14:14

I have the following script:

Timer=0;
function countdown(auctionid){
    var auctions;
    var divs;

    Timer=Timer+1;

    if((Timer%10==\"0\")||(Timer==\         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-16 14:29

    Using the Web Crypto api.

    console.log(
    
      crypto.getRandomValues(new Uint32Array(1))[0] ,
    
      crypto.getRandomValues(new Uint16Array(1))[0] ,
      
      crypto.getRandomValues(new Uint8Array(1))[0]
      
    )

    https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues https://caniuse.com/#feat=cryptography

提交回复
热议问题