Ruby  3.4.0dev (2024-11-23 revision b4d13fac3dd5420475aa1e14fdad8137da7e3ee0)
random.h
Go to the documentation of this file.
1 #ifndef RBIMPL_INTERN_RANDOM_H /*-*-C++-*-vi:se ft=cpp:*/
2 #define RBIMPL_INTERN_RANDOM_H
28 #include "ruby/internal/value.h"
29 
31 
32 /* random.c */
33 
34 
41 unsigned int rb_genrand_int32(void);
42 
49 double rb_genrand_real(void);
50 
56 void rb_reset_random_seed(void);
57 
73 VALUE rb_random_bytes(VALUE rnd, long n);
74 
81 unsigned int rb_random_int32(VALUE rnd);
82 
89 double rb_random_real(VALUE rnd);
90 
103 unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit);
104 
112 unsigned long rb_genrand_ulong_limited(unsigned long i);
113 
115 
116 #endif /* RBIMPL_INTERN_RANDOM_H */
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition: dllexport.h:74
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition: dllexport.h:65
unsigned long rb_genrand_ulong_limited(unsigned long i)
Generates a random number whose upper limit is i.
Definition: random.c:1076
double rb_random_real(VALUE rnd)
Identical to rb_genrand_real(), except it generates using the passed RNG.
Definition: random.c:1148
unsigned int rb_random_int32(VALUE rnd)
Identical to rb_genrand_int32(), except it generates using the passed RNG.
Definition: random.c:1105
void rb_reset_random_seed(void)
Resets the RNG behind rb_genrand_int32()/rb_genrand_real().
Definition: random.c:1787
VALUE rb_random_bytes(VALUE rnd, long n)
Generates a String of random bytes.
Definition: random.c:1306
double rb_genrand_real(void)
Generates a double random number.
Definition: random.c:206
unsigned long rb_random_ulong_limited(VALUE rnd, unsigned long limit)
Identical to rb_genrand_ulong_limited(), except it generates using the passed RNG.
Definition: random.c:1208
unsigned int rb_genrand_int32(void)
Generates a 32 bit random number.
Definition: random.c:199
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40