403Webshell
Server IP : 217.160.0.212  /  Your IP : 216.73.216.141
Web Server : Apache
System : Linux www 6.18.51-i1-ampere #1196 SMP Fri Sep 11 20:43:55 CEST 2026 aarch64
User : sws1073854427 ( 1073854427)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/pythran/pythonic/random/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/pythran/pythonic/random/shuffle.hpp
#ifndef PYTHONIC_RANDOM_SHUFFLE_HPP
#define PYTHONIC_RANDOM_SHUFFLE_HPP

#include "pythonic/include/random/shuffle.hpp"

#include "pythonic/utils/functor.hpp"
#include "pythonic/builtins/None.hpp"
#include "pythonic/random/random.hpp"

#include <limits>

PYTHONIC_NS_BEGIN

namespace random
{

  template <class T>
  types::none_type shuffle(T &seq)
  {
    std::shuffle(seq.begin(), seq.end(), __random_generator);
    return builtins::None;
  }

  namespace details
  {
    template <class function>
    struct URG {
      URG(function &&f) : randf(f)
      {
      }

      typedef unsigned result_type;
      static constexpr result_type min()
      {
        return 0;
      }
      /* -1 because of the floor() operation performed by the float->unsigned
       * conversion */
      static constexpr result_type max()
      {
        return std::numeric_limits<result_type>::max() - 1;
      }
      result_type operator()()
      {
        return randf() * std::numeric_limits<result_type>::max();
      }

      function randf;
    };
  }

  template <class T, class function>
  types::none_type shuffle(T &seq, function &&randf)
  {
    std::shuffle(seq.begin(), seq.end(),
                 details::URG<function>(std::forward<function>(randf)));
    return builtins::None;
  }
}

PYTHONIC_NS_END

#endif

Youez - 2016 - github.com/yon3zu
LinuXploit