M
Modular•3mo ago
Firas

How to random int ??

I have very simple: results = DTypePointer[type].alloc(batch * cols) how to generate random idex (int) in [0,batch * cols] ??? all the random function in mojo returns SIMD, how to convert simd to regular Int ?
3 Replies
Ryulord
Ryulord•3mo ago
var a: UInt32 = 42
var b = int(a)
var a: UInt32 = 42
var b = int(a)
Scalar types like UInt32 are just aliases for simd types like SIMD[DType.uint32, 1]
DobyDabaDu
DobyDabaDu•3mo ago
GitHub
Mojo-journey/Samples/Rock Paper Scissors/rps.mojo at main · yetalit...
My journey with Mojo programming language. Contribute to yetalit/Mojo-journey development by creating an account on GitHub.
Firas
FirasOP•3mo ago
ok thanks guys I was so confused and tired after hours of coding, all what I needed is the int() builtin function 🫂
Want results from more Discord servers?
Add your server