Guild icon
DDraceNetwork
Development / developer
Development discussion. Logged to https://ddnet.org/irclogs/ Connected with DDNet's IRC channel, Matrix room and GitHub repositories — IRC: #ddnet on Quakenet | Matrix: #ddnet-developer:matrix.org GitHub: https://github.com/ddnet
Between 2024-10-16 00:00 and 2024-10-17 00:00
Avatar
Avatar
jxsl13
have fun
justatest
Avatar
JavaScript Structs: Fixed Layout Objects. Contribute to tc39/proposal-structs development by creating an account on GitHub.
Avatar
hello everyone, I have a problem I was banned until October 19, although I don't have cheats, my nickname is yrasik, my friend also has such a problem, his nickname is Hard, I don't really know Russian and English, please explain if there are mistakes
Avatar
Avatar
yra_232
hello everyone, I have a problem I was banned until October 19, although I don't have cheats, my nickname is yrasik, my friend also has such a problem, his nickname is Hard, I don't really know Russian and English, please explain if there are mistakes
If you think you was banned by a mistake make a ticket in #✉-create-a-ticket "Ban appeal"
10:06
$deepl
Avatar
Avatar
oxyzo
$deepl
Hi! Most of us communicate in English. If you’re having trouble with English, use https://www.deepl.com/en/translator to help you out.
Avatar
translator ^
Avatar
chrome is enablign v3 manifest (edited)
10:33
disabling ublock
10:33
Firefox can automatically move bookmarks, passwords, history and other preferences from Chrome without deleting it or interfering with any of its settings.
Avatar
Jupstar ✪ 2024-10-16 10:34
I switch as soon as I see ads
Avatar
I recommend not to use chrome anymore
10:37
that's how google gets you
Avatar
Jupstar ✪ 2024-10-16 10:38
I use chromium, and I switch to brave or vivaldi as soon as I see ads xd
10:38
that simple
Avatar
Avatar
Jupstar ✪
Btw for all firefox enjoyers: https://www.mozilla.org/en-US/security/advisories/mfsa2024-51/ Update firefox
done
🚀 1
11:14
i upgraded and now it says i don't have internet
Avatar
Avatar
Teero
i upgraded and now it says i don't have internet
damn
Avatar
Jupstar ✪ 2024-10-16 11:16
Well no internet, no security problems
kek 1
11:16
I'd call it a fix
Avatar
no errors in console or anything xdd
11:16
like wtf?
11:16
it just cut me off
11:16
imagine i had no package manager!
11:16
i would be stranded
Avatar
Avatar
Teero
it just cut me off
Avatar
rolling back to 130.0-1 works
11:22
fu firefox
Avatar
didnt firefox had a security breach
Avatar
oka what browser to use
11:23
sadly i can't browse to search for browsers
11:23
since i don't have a browser
Avatar
can someone give me the link for the arch wiki browsers page?
Avatar
Jupstar ✪ 2024-10-16 11:24
Ez, exactly the one I posted actually
Avatar
okay nice i curl
Avatar
MilkeeyCat 2024-10-16 11:26
Is it possible to return a variable which is borrowed and variable which borrows it? something like let _ = { let foo = Foo {}; let bar = &foo; (foo, bar) }; (edited)
Avatar
Jupstar ✪ 2024-10-16 11:27
no
Avatar
Avatar
MilkeeyCat
Is it possible to return a variable which is borrowed and variable which borrows it? something like let _ = { let foo = Foo {}; let bar = &foo; (foo, bar) }; (edited)
is there a scenario where you'd need this?
Avatar
MilkeeyCat 2024-10-16 11:28
no xd
Avatar
just use chrome/chromium ig
Avatar
Avatar
Jupstar ✪
I use chromium, and I switch to brave or vivaldi as soon as I see ads xd
heinrich5991 2024-10-16 11:31
they won't support mv2, probably
Avatar
Avatar
heinrich5991
they won't support mv2, probably
Jupstar ✪ 2024-10-16 11:32
We'll see, brave claims they try to keep the required extensions running (edited)
Avatar
Avatar
MilkeeyCat
Is it possible to return a variable which is borrowed and variable which borrows it? something like let _ = { let foo = Foo {}; let bar = &foo; (foo, bar) }; (edited)
heinrich5991 2024-10-16 11:32
yes, various options using external crates
Avatar
Avatar
meloƞ
just use chrome/chromium ig
does chromium still support ublock?
Avatar
Avatar
Teero
does chromium still support ublock?
heinrich5991 2024-10-16 11:33
no
Avatar
was this not just about chrome?
11:34
seems like i can still install it on chromium. no idea if it works tho (edited)
Avatar
Avatar
heinrich5991
yes, various options using external crates
Jupstar ✪ 2024-10-16 11:34
How should that work in a safe way?
Avatar
heinrich5991 2024-10-16 11:35
This crate provides Yoke, which allows one to “yoke” (attach) a zero-copy deserialized object (say, a Cow<'a, str>) to the source it was deserialized from, (say, an Rc<[u8]>), known in this crate as a “cart”, producing a type that looks like Yoke, Rc<[u8]>> and can be moved around with impunity.
11:35
but that crate is on the more complicated side
11:35
basically, the insight is that this isn't unsafe when the borrowed thing is behind a pointer
11:35
struct A { buf: String, slice: &str, }
11:36
it's not a problem if the slice points into buf — moving it around causes no problems because the data slice points to is boxed
Avatar
Jupstar ✪ 2024-10-16 11:36
But mutability sounds like a problem here
Avatar
heinrich5991 2024-10-16 11:37
yea. these crates will not allow you to modify buf without also setting slice to a new value
Avatar
Jupstar ✪ 2024-10-16 11:37
Ah ok, then it makes sense yeah
Avatar
heinrich5991 2024-10-16 11:40
A crate for creating safe self-referencing structs.
Avatar
TIL, neat crate
Avatar
heinrich5991 2024-10-16 12:06
yup 🙂
12:06
new blog post
Avatar
heinrich5991 2024-10-16 12:07
@Learath2 I vaguely remember you asking me to ask you for the source of the finish server?
Avatar
MilkeeyCat 2024-10-16 12:07
it's not in OCaml, les gooooooooo
12:10
im getting into ocaml
12:10
OCaml is a general-purpose, industrial-strength programming language with an emphasis on expressiveness and safety.
12:10
ill use it for advent of code
Avatar
Avatar
heinrich5991
@Learath2 I vaguely remember you asking me to ask you for the source of the finish server?
Jupstar ✪ 2024-10-16 12:19
What is a finish server? Something for ddnet?
Avatar
heinrich5991 2024-10-16 12:20
stores (community, player name, map name) tuples so that communities can have the "finished" flag in the server browser
Avatar
Jupstar ✪ 2024-10-16 12:22
ah ok
Avatar
ocaml partial application seems cool
12:32
utop # let sum2 a b = a * b;; val sum2 : int -> int -> int = <fun> ─( 14:31:39 )─< command 14 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─ utop # let sum_with_2 = sum2 2;; val sum_with_2 : int -> int = <fun> ─( 14:31:44 )─< command 15 >──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────{ counter: 0 }─ utop # sum_with_2 4;; - : int = 8
12:33
(tbh i guess this is my first dive into a functional lang that isnt erlang)
12:33
erlang synax is so ugly
Avatar
heinrich5991 2024-10-16 12:34
ah, looks similar to haskell
Avatar
i guess, havent rly tried haskell yet
12:36
im more interested in ocaml cuz it has officia lllvm bindings and its used a lot in compile dev (edited)
Avatar
heinrich5991 2024-10-16 12:38
ah 🙂
12:39
I only know the original rust compiler was written in ocaml
12:39
anything else? 🙂
Avatar
MilkeeyCat 2024-10-16 12:43
https://github.com/MilkeeyCat/meraki/blob/e4bb8846e8b1e8a82be01f22741cd39852a43f8b/src/passes/macro_expansion.rs#L35-L55 Rust pros, is there a better way to handle opened shared objects? At first I just wanted to make a hashmap which would contain all functions from every library but that doesn't really work justatest (edited)
Avatar
heinrich5991 2024-10-16 12:45
what are you trying to do?
12:45
have a vector of what?
Avatar
Avatar
heinrich5991
I only know the original rust compiler was written in ocaml
12:47
this is a article on why ocaml is good for the compiler dev use case
Avatar
Avatar
heinrich5991
what are you trying to do?
MilkeeyCat 2024-10-16 12:48
Basically I need a function which would find a C function from all provided shared objects, if that makes sense xd
Avatar
heinrich5991 2024-10-16 12:49
I don't know about 7, 11 and 12, but I think haskell ticks the rest of the boxes
Avatar
Avatar
MilkeeyCat
Basically I need a function which would find a C function from all provided shared objects, if that makes sense xd
heinrich5991 2024-10-16 12:50
you want to open dynamic linked libraries from a list of file paths and check whether they have a specific symbol? what should the result be? a list of callable functions?
Avatar
Avatar
heinrich5991
you want to open dynamic linked libraries from a list of file paths and check whether they have a specific symbol? what should the result be? a list of callable functions?
MilkeeyCat 2024-10-16 12:50
it has to return only 1 function
Avatar
heinrich5991 2024-10-16 12:51
what is the input and what is the output?
12:51
input is a list of file paths and a function name?
12:51
output is that function from one of these libraries?
Avatar
@MilkeeyCat if u want a rust solution u can use this https://crates.io/crates/libloading
12:51
i used this lib its quite good
Avatar
heinrich5991 2024-10-16 12:52
we haven't even gotten to the problem statement yet ^^ @Ryozuki
Avatar
MilkeeyCat 2024-10-16 12:52
I use it already lol
Avatar
just wanted to mention it xd
12:54
In my opinion, the only language that can rival OCaml is Haskell. But OCaml has better performance and it allows mutability in critical parts of your code where it can benefit the performance.
12:54
@heinrich5991 a reddit comment i found
12:55
seems like haskell and ocaml compete a bit
Avatar
heinrich5991 2024-10-16 12:56
@MilkeeyCat what are the inputs and outputs you want to have?
Avatar
Avatar
heinrich5991
@MilkeeyCat what are the inputs and outputs you want to have?
MilkeeyCat 2024-10-16 12:59
there has to be a function new function takes an array of paths and returns Self, and I need a method which will find a function from paths provided in new
Avatar
Avatar
MilkeeyCat
https://github.com/MilkeeyCat/meraki/blob/e4bb8846e8b1e8a82be01f22741cd39852a43f8b/src/passes/macro_expansion.rs#L35-L55 Rust pros, is there a better way to handle opened shared objects? At first I just wanted to make a hashmap which would contain all functions from every library but that doesn't really work justatest (edited)
MilkeeyCat 2024-10-16 13:00
and that's how I look for a function by name
Avatar
heinrich5991 2024-10-16 13:04
if you want to return the function, you'll have to also return the library and tie their lifetime together
13:04
maybe it's easier to call the function instead of returning it?
Avatar
Jupstar ✪ 2024-10-16 13:06
Hey rust guyz: If I call clone on a Vec<u8>. Does rust make any assumption about the capacity of the new vector?
Avatar
heinrich5991 2024-10-16 13:06
rust doesn't give you any guarantees about the capacity
13:06
in this case
13:07
I'd guess it's the minimum necessary, in practice
Avatar
Jupstar ✪ 2024-10-16 13:07
So I should better do shrink_to_fit if storage is important?
Avatar
Avatar
heinrich5991
I'd guess it's the minimum necessary, in practice
Jupstar ✪ 2024-10-16 13:07
Yeah that is kinda the question 😄
Avatar
heinrich5991 2024-10-16 13:08
if you're going to freeze it from now on, maybe it'd be better to get a Box<[u8]> instead. that has minimum capacity
13:08
if you don't need to modify the old or the old one, then it should maybe be in a Arc<[u8]> so you don't have to keep two copies of it at all
Avatar
Avatar
Jupstar ✪
So I should better do shrink_to_fit if storage is important?
i think the cloned is shrinked to fit but no guarantee
Avatar
Avatar
heinrich5991
if you're going to freeze it from now on, maybe it'd be better to get a Box<[u8]> instead. that has minimum capacity
Jupstar ✪ 2024-10-16 13:08
Nope, I move the vec over an external API. And they defs don't shrink it
13:10
Well I'll test it out anyway, but still interest to know
Avatar
heinrich5991 2024-10-16 13:11
testing won't help if it's not guaranteed — a guaranteed version would be Vec::from(Box::from(slice))
Avatar
Jupstar ✪ 2024-10-16 13:12
I mean a call to shrink_to_fit will most likely fit it or not
Avatar
heinrich5991 2024-10-16 13:12
yes
13:12
that's guaranteed
13:13
looking at the source code, the current Vec::clone generates the minimum necessary capacity
Avatar
Jupstar ✪ 2024-10-16 13:14
tja did not help, so it didn't shrink it further at least on my PC D:
13:14
I hate chinese fonts 😬
Avatar
Jupstar ✪ 2024-10-16 13:17
Ok thx, I'll continue my journey to lower memory consumption bcs of chinese fonts in different ways then xD
Avatar
@Learath2 are u using tokio and any lock in the finish server?
13:26
remember that if u hold a lock across .awaits you should use the tokio locks otherwise u should use the std locks
Avatar
Jupstar ✪ 2024-10-16 13:29
I'd recommend not holding locks across await (edited)
Avatar
Avatar
Ryozuki
remember that if u hold a lock across .awaits you should use the tokio locks otherwise u should use the std locks
Jupstar ✪ 2024-10-16 13:30
Btw rust warns about this anyway
13:30
Even false positive xD
Avatar
Avatar
Jupstar ✪
Btw rust warns about this anyway
does it?
Avatar
Jupstar ✪ 2024-10-16 13:30
Yep
13:31
You have to scope all locks with {}. Else the warning doesn't go away
Avatar
heinrich5991 2024-10-16 13:31
you shouldn't hold a lock across an await, probably
13:31
because await sounds like "takes a long time" but locks shouldn't be held for a long time
13:32
am i confusing things?=
13:32
no warnings
Avatar
Avatar
heinrich5991
because await sounds like "takes a long time" but locks shouldn't be held for a long time
yeah, but just in case tokio provides async locks
Avatar
heinrich5991 2024-10-16 13:32
that future is no longer Send
Avatar
heinrich5991 2024-10-16 13:33
but tokio generally requires futures to be Send
Avatar
Avatar
Jupstar ✪
You aren't locking anything btw xd
xd
13:38
true
13:38
lol
13:39
i need coffee
13:39
still no warn
Avatar
omg coffee is a good idea
Avatar
Avatar
Ryozuki
still no warn
Jupstar ✪ 2024-10-16 13:43
Click on tools, clippy
13:45
u right
Avatar
heinrich5991 2024-10-16 13:45
please paste text as text ^^
13:45
images are annoying (IMO) and not searchable
Avatar
well bbut the image gets the point faster
13:46
i pasted the playground link
13:46
for text gurus
Avatar
heinrich5991 2024-10-16 13:47
warning: this `MutexGuard` is held across an await point --> src/lib.rs:5:9 | 5 | let x = a.read().unwrap(); | ^ | = help: consider using an async-aware `Mutex` type or ensuring the `MutexGuard` is dropped before calling `await` note: these are all the await points this lock is held through --> src/lib.rs:6:14 | 6 | hello2().await; | ^^^^^ = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#await_holding_lock = note: `#[warn(clippy::await_holding_lock)]` on by default
13:47
this is what the text would look like. is that worse than the picture?
Avatar
the pic has the code on the side
13:48
xd
Avatar
Jupstar ✪ 2024-10-16 13:48
xd
Avatar
"The LLVM of columnar file formats". A toolkit for working with compressed Arrow on-disk, in-memory, and over-the-wire. - spiraldb/vortex
Avatar
Avatar
heinrich5991
@Learath2 I vaguely remember you asking me to ask you for the source of the finish server?
Aha, yes, I'll do it when I get home. I work/study outside for the last couple days because I kept getting distracted at home
Avatar
heinrich5991 2024-10-16 14:51
sounds like a very good idea 🙂
14:51
sorry for distracting you
Avatar
Avatar
Ryozuki
@Learath2 are u using tokio and any lock in the finish server?
Axum, so yes, I'm using tokio. No I don't need to hold any locks across any awaits. I'll leave handling that sort of synchronization to the db which is almost the only place I'd need to hold a lock across an await anyway
14:57
Also I forgot to give y'all extremely useful english words today. pugnacious = belligerent = combative (edited)
Avatar
heinrich5991 2024-10-16 14:57
I knew belligerent
14:58
I think it appeard in harry potter?
Avatar
It also appears a lot in the context of occupation of countries
14:59
Let me give you a different one, opprobrium = censure
Avatar
heinrich5991 2024-10-16 15:00
I only learned censure a year ago or so
Avatar
censor
Avatar
Avatar
fokkonaut
censor
you're alive!
Avatar
Ofc
Avatar
i thought you got sent to the shadow realms
Avatar
hmm, i've been there
Avatar
Jupstar ✪ 2024-10-16 15:32
ChillerDragon is there xD
Avatar
but back
Avatar
Avatar
Jupstar ✪
ChillerDragon is there xD
oh wait is the bridge still locked?
Avatar
Jupstar ✪ 2024-10-16 15:33
ig
15:33
Or he rq
Avatar
Chillerdragon:
Avatar
he has shit to do
Avatar
Avatar
fokkonaut
he has shit to do
like avoid paying taxes?
Avatar
I aint allowed to say anything
15:34
just
15:34
he'll come by if he needs to
15:35
@melone
15:35
How are you
Avatar
Avatar
fokkonaut
@melone
super tired, i just went shopping and spent 40€ on 2 days worth of food, it's ridiculous
15:36
but that may be more fitting for #off-topic
Avatar
oof
15:36
Maybe consider stealing next time
KEKW 2
Avatar
Avatar
fokkonaut
Maybe consider stealing next time
i should've, i literally only bought bread, milk, water, cereal and babyfood
Avatar
Jupstar ✪ 2024-10-16 17:06
File .text Size Crate 2.1% 30.7% 14.5MiB [Unknown] 0.8% 12.3% 5.8MiB std 0.4% 5.3% 2.5MiB ffmpeg_sys_next 0.2% 2.8% 1.3MiB cranelift_codegen 0.2% 2.8% 1.3MiB tokio 0.2% 2.2% 1.1MiB naga 0.1% 2.2% 1.0MiB wasmparser 0.1% 1.8% 887.9KiB client_ui 0.1% 1.8% 871.2KiB hashbrown 0.1% 1.8% 849.3KiB client_containers 0.1% 1.5% 730.9KiB rayon_core 0.1% 1.2% 579.2KiB egui 0.1% 1.1% 555.8KiB rustls 0.1% 1.0% 471.6KiB game_config 0.1% 0.9% 431.0KiB ddnet_playground 0.1% 0.9% 420.8KiB winit 0.1% 0.8% 390.7KiB serde_json 0.1% 0.8% 385.4KiB editor 0.1% 0.7% 358.2KiB regalloc2 0.0% 0.7% 352.6KiB zstd_sys 1.6% 22.9% 10.8MiB And 311 more crates. Use -n N to show more. 6.8% 100.0% 47.2MiB .text section size LTO, codegen-units = 1, strip, panic = "abort". Still the exec is around 60MiB
17:06
So insane xD
17:08
Maybe std could be lowered by compiling the crates for it. But 5MiB also doesn't make any diff then anymore xD
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
heinrich5991 2024-10-16 17:09
how does nix fix security issues?
17:10
what is "unknown"?
Avatar
Jupstar ✪ 2024-10-16 17:10
Well I'd like to know too xD
Avatar
heinrich5991 2024-10-16 17:10
😄
Avatar
Jupstar ✪ 2024-10-16 17:11
Tool is cargo bloat btw
Avatar
heinrich5991 2024-10-16 17:11
This repository has been archived by the owner on Oct 14, 2024. It is now read-only.
17:11
the day before yesterday
17:11
nice
Avatar
Avatar
heinrich5991
how does nix fix security issues?
Avolicious 2024-10-16 17:12
They dont, its left up to you to maintain 😄
Avatar
Avatar
Ryozuki
Click to see attachment 🖼️
me who uses nixOS and codes in rust™️gigachad
Avatar
pls help compiling src clion mingw windows x64 ====================[ Build | game-client | Debug ]============================= "C:\Program Files\JetBrains\CLion 2024.2.2\bin\cmake\win\x64\bin\cmake.exe" --build C:\Users\ggdddz\Desktop\projects\ddnet\cmake-build-debug --target game-client -j 14 [0/2] Generating debug/libddnet_engine_shared.a Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.08s [2/2] Linking CXX executable DDNet.exe FAILED: DDNet.exe C:\Windows\system32\cmd.exe /C "cd . && C:\mingw64\bin\c++.exe -g -mwindows @CMakeFiles\game-client.rsp -o DDNet.exe -Wl,--out-implib,libDDNet.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ." C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find debug/libddnet_engine_shared.a: No such file or directory collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed. when starting game-client (edited)
17:31
debug/libddnet_engine_shared.a dont creating
17:31
but
17:31
creating libddnet_engine.rlib
Avatar
change your rust toolchain to use msvc rustup default stable-x86_64-pc-windows-msvc (edited)
Avatar
ok wait
Avatar
@heinrich5991 any idea on how to solve #7660 ? - i can't find any documentation towards this and i'm not in any way proficient in cmake
Avatar
im back
17:38
C:\Windows\system32\cmd.exe /C "cd . && C:\mingw64\bin\c++.exe -g -mwindows @CMakeFiles\game-client.rsp -o DDNet.exe -Wl,--out-implib,libDDNet.dll.a -Wl,--major-image-version,0,--minor-image-version,0 && cd ." C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find debug/libddnet_engine_shared.a: No such file or directory collect2.exe: error: ld returned 1 exit status ninja: build stopped: subcommand failed.
17:38
dont helped
17:38
17:44
@meloƞ sry for ping
Avatar
rustup default stable-x86_64-pc-windows-msvc and then click on the hammer to rebuild the project
Avatar
You need rustup default stable-x86_64-pc-windows-gnu if you use mingw/GNU
Avatar
Avatar
Robyt3
You need rustup default stable-x86_64-pc-windows-gnu if you use mingw/GNU
THX
brownbear 1
17:51
u best
Avatar
Avatar
Learath2
Aha, yes, I'll do it when I get home. I work/study outside for the last couple days because I kept getting distracted at home
it'll have to wait another day, I get dysfunctional on days before exams, far too much anxiety to think of anything else
Avatar
`#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main ( ) { const int minValue = 1; const int maxValue = 6; srand(time(0)); short first = (rand() % (maxValue - minValue + 1)) + minValue; short second = (rand() % (maxValue - minValue + 1)) + minValue; cout << first << ", " << second; return 0; }` cool dice
Avatar
please use 3x to create a code block this is a codeblock #include <iostream> int main () { return 0; }; `
18:14
Avatar
or use //
18:15
nvm
Avatar
Avatar
meloƞ
please use 3x to create a code block this is a codeblock #include <iostream> int main () { return 0; }; `
alright thanks
18:16
!
Avatar
Avatar
meloƞ
i should've, i literally only bought bread, milk, water, cereal and babyfood
xdx
Avatar
Avatar
meloƞ
@heinrich5991 any idea on how to solve #7660 ? - i can't find any documentation towards this and i'm not in any way proficient in cmake
heinrich5991 2024-10-16 19:01
no idea. first step would be to figure out how one checks the current rust toolchain (using rustup, probably) and how one checks the current C++ toolchain (in cmake, probably)
19:01
if you find the answers to this, you can comment them on the isuse
Avatar
Avatar
basicaly
`#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main ( ) { const int minValue = 1; const int maxValue = 6; srand(time(0)); short first = (rand() % (maxValue - minValue + 1)) + minValue; short second = (rand() % (maxValue - minValue + 1)) + minValue; cout << first << ", " << second; return 0; }` cool dice
heinrich5991 2024-10-16 19:03
a couple of problems: 1) this has slightly higher probability for 1 than 6 2) it can only generate new random numbers every second
Avatar
Use ``` code ```
Avatar
that's what I'm repeating
20:00
but more visually with backtocks instead of 3x `
20:00
backticks
20:00
you can escape backticks with a backslash
20:02
there is an image that I did not look at, tho, which is also very visual :()
Avatar
GitHub BOT 2024-10-16 21:15
Show popup to select the envelope curve type from a list when right clicking the curve type button, as selecting the curve type by pressing the button multiple times is inconvenient. Switch to previous curve type on shift+left clicking the curve type button. !image

Checklist

  • [X] Tested the change ingame
  • [X] Provided screenshots if it is a visual change
  • [ ] Tested in combination with possi...
Avatar
Can someone add an alias for /grenade in /practice mode? /rocket would be good, as most people call it rocket
Avatar
Avatar
basicaly
`#include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main ( ) { const int minValue = 1; const int maxValue = 6; srand(time(0)); short first = (rand() % (maxValue - minValue + 1)) + minValue; short second = (rand() % (maxValue - minValue + 1)) + minValue; cout << first << ", " << second; return 0; }` cool dice
c++ #include <iostream> #include <random> int main(void) { std::random_device rd; std::mt19937 g(rd()); std::uniform_int_distribution<int> dist(1, 6); std::cout << dist(g) << ", " << dist(g) << std::endl; return 0; }
21:55
or std::minstd_rand instead of std::mt19937 doesn't really matter much honestly which generator you use
Avatar
heinrich5991 2024-10-16 22:10
it's unclear to me why c++ went with an rng that requires such a large state as mersenne twister
22:12
xoshiro/pcg seem so much better
22:13
ah, and mersenne twister also generates bad random numbers, apparently
22:16
One likely reason for adopting such a system is that ISPs in China often implement DNS hijacking to insert ads and redirect web traffic to perform ad fraud. The problem was so serious that six Chinese internet giants issued a joint statement in 2015 urging ISPs to improve. According to the news article, about 1–2% of traffic to Meituan (an online shopping site) suffers from DNS hijacking. Ad fraud by Chinese ISPs seems to remain a widespread problem in recent years.
22:16
This report performs the first public analysis of MMTLS, the main network protocol used by WeChat, an app with over one billion users. The report finds that MMTLS is a modified version of TLS, however some of the modifications have introduced cryptographic weaknesses.
Avatar
Avatar
heinrich5991
xoshiro/pcg seem so much better
Jupstar ✪ 2024-10-16 22:21
Xoshiro256StarStar is the best
22:22
Bcs of the name
Avatar
xoshiro is newer than mt19937
Avatar
Avatar
heinrich5991
it's unclear to me why c++ went with an rng that requires such a large state as mersenne twister
Hm, I don't remember but are older xorshift generators strictly better than mersenne twister? The earliest xorshift ones do predate the standard random header but idk if modern "good" ones are old enough
Avatar
every rng implementation has to just pick one of the algorithms on the pareto front, but there's not many people online who will tell you what those are.
Avatar
David Blackman and Sebastiano Vigna. Scrambled linear pseudorandom number generators. ACM Trans. Math. Softw., 47:1−32, 2021.
This is the paper that xoshiro256++/xoshiro256** seems to be first referenced in
22:44
Actually the initial revision of its is from 2018, but still not quite old enough to be in C++11
22:47
Though it seems the idea of scrambling the output of a xorshift generator has existed since 2005, so idk maybe they were around and just no one bothered
Avatar
it looks like there's many generations of xorshiro algorithms
22:48
xoshiro, xoroshiro, xoroshiro+, xoroshiro star
Avatar
XOr ROtate SHiftand iirc the + ++ * ** signify the output scramblers
22:50
+ and ++ have less random lower bits, ** has better randomness but is trivially reversible
Avatar
lol the PCG people and the xorshift people have drama https://pcg.di.unimi.it/pcg.php https://www.pcg-random.org/
Avatar
they argue a lot it seems
23:10
but the difference is probably marginal unless you have very specific criteria
23:13
I think it's pretty safe to assume the cpp std::rand() is literally never a good choice (edited)
✅ 1
23:26
it's impressive how little consensus there is
23:28
everyone runs their own separate and unique prng test suites that do not agree with each other, idk why there isn't just some standard authority that lets you submit your generator and it runs against every benchmark conceivable.
23:31
I would say it's completely reasonable that cpp standard chose mt19937 in 2011 it would have been extremely unclear that pcg or xorshiro were better at that time
23:32
some people are still claiming that the default xorshiro in V8 is bad https://arxiv.org/abs/1908.10020
Exported 290 message(s)
Timezone: UTC+0