How to generate random numbers in kernel?

I tried this

@ti.kernel
def test():
    a = ti.random(ti.int64)
    print(a)

test()

and I got the error

Compiling kernel test_0_...
[E 12/16/19 11:01:59.810] [codegen_llvm.h:visit@254] Not Implemented.
[E 12/16/19 11:01:59.810] Received signal 6 (Abort trap: 6)

                            * Taichi Core - Stack Traceback *                             
==========================================================================================
|                       Module |  Offset | Function                                      |
|----------------------------------------------------------------------------------------|
*               taichi_core.so |     295 | taichi::signal_handler(int)                   |
*     libsystem_platform.dylib |      29 | (null)                                        |
*                          ??? |       0 | (null)                                        |
*            libsystem_c.dylib |      26 | (null)                                        |
*               taichi_core.so |     508 | taichi::Tlang::CodeGenLLVM::visit(taichi::Tla |
                                         | ng::RandStmt*)                                |
*               taichi_core.so |      43 | taichi::Tlang::CPUIRCodeGen::visit(taichi::Tl |
                                         | ang::Block*)                                  |
*               taichi_core.so |      87 | taichi::Tlang::CodeGenLLVM::visit(taichi::Tla |
                                         | ng::OffloadedStmt*)                           |
*               taichi_core.so |      43 | taichi::Tlang::CPUIRCodeGen::visit(taichi::Tl |
                                         | ang::Block*)                                  |
*               taichi_core.so |     162 | taichi::Tlang::CPUCodeGen::codegen_llvm()     |
*               taichi_core.so |     147 | taichi::Tlang::KernelCodeGen::compile(taichi: |
                                         | :Tlang::Program&, taichi::Tlang::Kernel&)     |
*               taichi_core.so |     280 | taichi::Tlang::Program::compile(taichi::Tlang |
                                         | ::Kernel&)                                    |
*               taichi_core.so |      53 | taichi::Tlang::Kernel::compile()              |
*               taichi_core.so |      48 | taichi::Tlang::Kernel::operator()()           |
*               taichi_core.so |     105 | void pybind11::cpp_function::initialize<pybin |
                                         | d11::cpp_function::cpp_function<void, taichi: |
                                         | :Tlang::Kernel, pybind11::name, pybind11::is_ |
                                         | method, pybind11::sibling>(void (taichi::Tlan |
                                         | g::Kernel::*)(), pybind11::name const&, pybin |
                                         | d11::is_method const&, pybind11::sibling cons |
                                         | t&)::'lambda'(taichi::Tlang::Kernel*), void,  |
                                         | taichi::Tlang::Kernel*, pybind11::name, pybin |
                                         | d11::is_method, pybind11::sibling>(void&&, ta |
                                         | ichi::Tlang::Kernel (*)(), pybind11::name con |
                                         | st&, pybind11::is_method const&, pybind11::si |
                                         | bling const&)::'lambda'(pybind11::detail::fun |
                                         | ction_call&)::__invoke(pybind11::detail::func |
                                         | tion_call&)                                   |
*               taichi_core.so |    2874 | pybind11::cpp_function::dispatcher(_object*,  |
                                         | _object*, _object*)                           |
*                       python |     456 | (null)                                        |
*                       python |     111 | (null)                                        |
*                       python |     130 | (null)                                        |
*                       python |     130 | (null)                                        |
*                       python |     370 | (null)                                        |
*                       python |     179 | (null)                                        |
*                       python |     404 | (null)                                        |
*                       python |   45343 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     231 | (null)                                        |
*                       python |   45871 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     231 | (null)                                        |
*                       python |     189 | (null)                                        |
*                       python |     179 | (null)                                        |
*                       python |     404 | (null)                                        |
*                       python |   45343 | (null)                                        |
*                       python |     418 | (null)                                        |
*                       python |     256 | (null)                                        |
*                       python |     391 | (null)                                        |
*                       python |    9564 | (null)                                        |
*                       python |     125 | (null)                                        |
*                libdyld.dylib |       1 | (null)                                        |
*                          ??? |       2 | (null)                                        |
==========================================================================================

It seems that the algorithm has not been implemented.

In addition, can I set a random seed or randomize the random seed?

ti.random now only works for ti.f32 and ti.f64. Integer types will be supported in the next release. Currently setting random seeds is not supported.

v0.2.6 (pending at build bots) now supports ti.random(ti.i32/i64).