To set a custom seed for the random number generator used by ti.random(): ti.init(random_seed=seed). seed should be an integer. An example: ti.init(random_seed=int(time.time())).
import time
import taichi as ti
ti.init(arch=ti.vulkan,random_seed=int(time.time()))
@ti.kernel
def main() -> ti.f32:
return ti.random(ti.f32)
print(main())
Relevant docs: https://docs.taichi-lang.org/docs/global_settings#runtime
macOS 12.6 (21G115), M1