• Resolved pexel

    (@pexel)


    Hello;
    How can I generate 6 random numbers next to each other between 1 and 60?

    Example: 05-11-17-19-55-59 (This way)

    I tried something below, but it didn’t work.
    Do you have any suggestions?

    (function () {
        var kriter2 = '';
        var rakamlar = [];
    
     
        for (var i = 1; i <= 60; i++) {
            rakamlar.push(i);
        }
    
        rakamlar.sort(function () {
            return 0.5 - Math.random();
        });
    
        kriter2 = rakamlar.slice(0, 6).join('-');
    
        jQuery('#calculation-kriter2').html(kriter2);
        jQuery('.kriter2-aciklama').html('Kilo : ');
        jQuery('.kriter2-sonuc').html(kriter2);
    
        return kriter2;
    })();
    
    • This topic was modified 2 years, 5 months ago by pexel.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @pexel,

    You can use the RANDOM operation in the plugin as follows:

    
    (function(){
    var result = [];
    for(var i=0; i<6; i++) result.push(RANDOM({min:1, max:60, int:1}));
    return result.join('-');
    })()

    Best regards.

    Thread Starter pexel

    (@pexel)

    Hello;
    Thanks

    • This reply was modified 2 years, 5 months ago by pexel.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Generating Random Numbers’ is closed to new replies.