From ddb88575c0901b864458958f4c8db2cf12c0b07d Mon Sep 17 00:00:00 2001 From: Moritz Fuller <32162112+letmejustputthishere@users.noreply.github.com> Date: Wed, 20 Nov 2024 12:54:33 +0100 Subject: [PATCH 1/3] Update randomness.mdx --- .../advanced-features/randomness.mdx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx index beb85d4326..ed94d737c2 100644 --- a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx +++ b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx @@ -37,26 +37,23 @@ Developers can directly access randomness through the `raw_rand` method in the m ```motoko -actor { - let SubnetManager : actor { - raw_rand() : async Blob; - } = actor "aaaaa-aa"; +import Random "mo:base/Random"; +actor { public func random_bytes() : async Blob { - let bytes = await SubnetManager.raw_rand(); - return bytes; + await Random.blob(); }; }; ``` -In addition to the `raw_rand` method, Motoko offers a [Random module](/docs/current/motoko/main/base/Random) for generating random numbers. +In addition to the `Random.blob()` method, developers can call the `raw_rand` method function on the management canister directly. ```rust -let (randomBytes,): (Vec,) = ic_cdk::api::call(Principal.management_canister(), "raw_rand", ()).await?; +let (randomBytes,): (Vec,) = ic_cdk::api::management_canister::main::raw_rand().await?; ``` From 46291d58aaa4c3094a2ab1cefd432545b5ffb7d9 Mon Sep 17 00:00:00 2001 From: Moritz Fuller <32162112+letmejustputthishere@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:09:45 +0100 Subject: [PATCH 2/3] Update randomness.mdx --- .../smart-contracts/advanced-features/randomness.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx index ed94d737c2..0ccc5a54ee 100644 --- a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx +++ b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx @@ -37,16 +37,16 @@ Developers can directly access randomness through the `raw_rand` method in the m ```motoko -import Random "mo:base/Random"; +import IC "ic:aaaaa-aa"; actor { public func random_bytes() : async Blob { - await Random.blob(); + await IC.raw_rand(); }; }; ``` -In addition to the `Random.blob()` method, developers can call the `raw_rand` method function on the management canister directly. +In addition to the raw_rand method, Motoko offers a [Random module](https://internetcomputer.org/docs/current/motoko/main/base/Random) for generating random numbers. From 174cc5c0267691c30bfcf23fbaf7047d6812a17a Mon Sep 17 00:00:00 2001 From: Moritz Fuller <32162112+letmejustputthishere@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:10:39 +0100 Subject: [PATCH 3/3] Update randomness.mdx --- .../smart-contracts/advanced-features/randomness.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx index 0ccc5a54ee..307b1c4993 100644 --- a/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx +++ b/docs/developer-docs/smart-contracts/advanced-features/randomness.mdx @@ -46,7 +46,7 @@ actor { }; ``` -In addition to the raw_rand method, Motoko offers a [Random module](https://internetcomputer.org/docs/current/motoko/main/base/Random) for generating random numbers. +In addition to the `raw_rand` method, Motoko offers a [Random module](/docs/current/motoko/main/base/Random) for generating random numbers.