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
Scalar types like
UInt32
are just aliases for simd types like SIMD[DType.uint32, 1]
This piece of code might be useful for you: https://github.com/yetalit/Mojo-journey/blob/main/Samples%2FRock%20Paper%20Scissors%2Frps.mojo
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.
ok thanks guys I was so confused and tired after hours of coding, all what I needed is the int() builtin function 🫂