Rust 程序设计语言 简体中文版 1.85.0std::io; use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1..=100); println!("The secret number is: {secret_number}"); println!("Please trait,它定义了随机数生成器应实现的 方法,想使用这些方法的话,此 trait 必须在作用域中。第十章会详细介绍 trait。 接下来,我们在中间还新增加了两行。第一行调用了 rand::thread_rng 函数提供实际使用的 随机数生成器:它位于当前执行线程的本地环境中,并从操作系统获取 seed。接着调用随机 数生成器的 gen_range 方法。这个方法由 use rand::Rng guessed: 60 Too big! Please input your guess. 59 You guessed: 59 You win! Please input your guess. quit thread 'main' panicked at src/main.rs:28:47: Please type a number!: ParseIntError { kind: InvalidDigit }0 码力 | 562 页 | 3.23 MB | 23 天前3
Tornado 6.5 Documentationdifferent from most Python web frameworks. It is not based on WSGI, and it is typically run with only one thread per process. See the User’s guide for more on Tornado’s approach to asynchronous programming. While interfaces (such as tornado.web) directly instead of using WSGI. In general, Tornado code is not thread-safe. The only method in Tornado that is safe to call from other threads is IOLoop.add_callback. You can also use IOLoop.run_in_executor to asynchronously run a blocking function on another thread, but note that the function passed to run_in_executor should avoid referencing any Tornado objects.0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 Documentationnot based on WSGI [https://wsgi.readthedocs.io/en/latest/], and it is typically run with only one thread per process. See the User’s guide for more on Tornado’s approach to asynchronous programming. While interfaces (such as tornado.web) directly instead of using WSGI. In general, Tornado code is not thread-safe. The only method in Tornado that is safe to call from other threads is IOLoop.add_callback. You can also use IOLoop.run_in_executor to asynchronously run a blocking function on another thread, but note that the function passed to run_in_executor should avoid referencing any Tornado objects.0 码力 | 437 页 | 405.14 KB | 3 月前3
Julia 1.12.0 RC1Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3
julia 1.12.0 beta1Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2047 页 | 7.41 MB | 3 月前3
julia 1.13.0 DEVAccessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2058 页 | 7.45 MB | 3 月前3
Julia 1.11.6 Release NotesAccessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 25.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 2007 页 | 6.73 MB | 3 月前3
julia 1.10.10Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 27.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 27.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 24.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 1692 页 | 6.34 MB | 3 月前3
共 22 条
- 1
- 2
- 3













