foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions
genrand_serviceabstract

#include <genrand.h>

+ Inheritance diagram for genrand_service:

Public Member Functions

 FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT (genrand_service)
 
void generate_random_order (t_size *out, t_size count)
 
virtual unsigned genrand (unsigned range)=0
 
double genrand_f ()
 
virtual void seed (unsigned val)=0
 
- Public Member Functions inherited from service_base
template<typename outPtr_t >
bool cast (outPtr_t &outPtr)
 
virtual int service_add_ref ()=0 throw ()
 
virtual bool service_query (service_ptr_t< service_base > &p_out, const GUID &p_guid)
 
template<class T >
bool service_query_t (service_ptr_t< T > &p_out)
 
virtual int service_release ()=0 throw ()
 

Static Public Member Functions

static service_ptr_t< genrand_serviceg_create ()
 

Additional Inherited Members

- Public Types inherited from service_base
typedef service_base t_interface
 
- Protected Member Functions inherited from service_base
 service_base ()
 
 ~service_base ()
 

Detailed Description

PRNG service. Implemented by the core, do not reimplement. Use g_create() helper function to instantiate.

Definition at line 2 of file genrand.h.

Member Function Documentation

genrand_service::FB2K_MAKE_SERVICE_INTERFACE_ENTRYPOINT ( genrand_service  )
static service_ptr_t<genrand_service> genrand_service::g_create ( )
inlinestatic

Definition at line 12 of file genrand.h.

12 {return standard_api_create_t<genrand_service>();}
void genrand_service::generate_random_order ( t_size out,
t_size  count 
)
inline

Definition at line 14 of file genrand.h.

14  {
15  unsigned genrandMax = (unsigned) pfc::min_t<size_t>(count, 0xFFFFFFFF);
16  t_size n;
17  for(n=0;n<count;n++) out[n]=n;
18  for(n=0;n<count;n++) pfc::swap_t(out[n],out[genrand(genrandMax)]);
19  }
size_t t_size
Definition: int_types.h:48
virtual unsigned genrand(unsigned range)=0
Returns random value N, where 0 <= N < range.
void swap_t(T &p_item1, T &p_item2)
Definition: primitives.h:285
virtual unsigned genrand_service::genrand ( unsigned  range)
pure virtual

Returns random value N, where 0 <= N < range.

double genrand_service::genrand_f ( )
inline

Definition at line 10 of file genrand.h.

10 { return (double)genrand(0xFFFFFFFF) / (double)0xFFFFFFFF; }
virtual unsigned genrand(unsigned range)=0
Returns random value N, where 0 <= N < range.
virtual void genrand_service::seed ( unsigned  val)
pure virtual

Seeds the PRNG with specified value.


The documentation for this class was generated from the following file: