def METHOD_NAME(rand_func, owner):
    nb_threads = prefs.devices.cpp_standalone.openmp_threads
    if nb_threads == 0:  # no OpenMP
        thread_number = "0"
    else:
        thread_number = "omp_get_thread_num()"
    if rand_func == "rand":
        rk_call = "rk_double"
    elif rand_func == "randn":
        rk_call = "rk_gauss"
    else:
        raise AssertionError(rand_func)
    code = """
           double _%RAND_FUNC%(const int _vectorisation_idx) {
               return %RK_CALL%(brian::_mersenne_twister_states[%THREAD_NUMBER%]);
           }
           """
    code = replace(
        code,
        {
            "%THREAD_NUMBER%": thread_number,
            "%RAND_FUNC%": rand_func,
            "%RK_CALL%": rk_call,
        },
    )
    return {"support_code": code}