import React, { useState } from 'react';

function randCode(){
//    const [ranNumArr,setRanNumArr] = useState([]);

    const min = 1;
    const max = 99999;
    let newNum = Math.floor((Math.random()*max)+min);
    
    // for (let i=0;i<ranNumArr.length;i++){
    //     if (ranNumArr[i]==newNum){
    //         newNum = Math.floor((Math.random()*max)+min);
    //     }
    // }
    
    let zeroSize = "";

    for (let j=0;j<5-newNum.toString().length;j++){
        zeroSize += "0";
    }

    // setRanNumArr(zeroSize+newNum);

    return (zeroSize+newNum.toString());
}

export default randCode;