Jump to content

Random


dc_jt

Recommended Posts

Sorry, thats way off. Half asleep here.

 

<?php

  function rands($n,$s,$e) {
    $return = array();
    for ($i=0;$i<$n;$i++) {
      $num = rand($s,$e);
      do {
        $num = rand($s,$e);
      } while (in_array($num,$return));
      $return[] = $num;
    }
    return $return;
  }

  $rands = rands(3,1,6);
  echo implode(' ', $rands);

?>

Link to comment
https://forums.phpfreaks.com/topic/91079-random/#findComment-466812
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.