File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,13 @@ namespace nodepp { namespace os {
4141 inline int exec ( string_t cmd ){ return ::system ( cmd.get () ); }
4242
4343 inline int call ( string_t cmd ){ return ::system ( cmd.get () ); }
44+
45+ inline uchar_64 rand () {
46+ thread_local static uchar_64 seed = (uchar_64)&seed;
47+ seed ^= seed << 0x11 ;
48+ seed ^= seed >> 0x07 ;
49+ seed ^= seed << 0x0b ; return seed;
50+ }
4451
4552 /* ─······································································─*/
4653
Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ namespace nodepp { namespace os {
5959
6060 inline int call ( string_t cmd ){ return ::system ( cmd.get () ); }
6161
62+ inline uchar_64 rand () {
63+ thread_local static uchar_64 seed = (uchar_64)&seed;
64+ seed ^= seed << 0x11 ;
65+ seed ^= seed >> 0x07 ;
66+ seed ^= seed << 0x0b ; return seed;
67+ }
68+
6269 /* ─······································································─*/
6370
6471 inline uint pid (){ return GetCurrentProcessId (); }
Original file line number Diff line number Diff line change 11#include < nodepp/nodepp.h>
2+ #include < nodepp/timer.h>
23
34using namespace nodepp ;
45
56/* ────────────────────────────────────────────────────────────────────────────*/
67
78void onMain () {
89
9- handler_t <int > hdl;
10+ console::log ( encoder::hex::atob ( 17 ) );
11+ console::log ( encoder::hex::atob ( 7 ) );
12+ console::log ( encoder::hex::atob ( 13 ) );
1013
11- auto hdl1 = hdl.create (); hdl.update ( hdl1, 10 );
12- auto hdl2 = hdl.create (); hdl.update ( hdl2, 20 );
13- auto hdl3 = hdl.create (); hdl.update ( hdl3, 30 );
14- auto hdl4 = hdl.create (); hdl.update ( hdl4, 40 );
15-
16- hdl.get_queue ().swap (
17- hdl.get_queue ().first (),
18- hdl.get_queue ().last ()
19- );
20-
21- console::log ( hdl.read ( hdl1 )[0 ] );
22- console::log ( hdl.read ( hdl4 )[0 ] );
14+ timer::add ([=](){
15+ console::log ( os::rand () );
16+ return 1 ; }, 1000 );
2317
2418}
2519
You can’t perform that action at this time.
0 commit comments