Rand
lib is supported in rust
but not supported in anchor lang
. I want to generate a random number lets say between a range of 0-10. Is there is a way I can do in anchor lang. Or alternatively, if there is a way I could use candy machine random NFT functionality with url
as I want to use random numbers to be passed in url.
Code snippet:
let random_number = 0; // this is supposed to be a random number let say b/w [0-10]
let path = "http://abc.com";
let new_uri = format!("{}{}{}", path, random_number, ".json");
invoke(
&create_metadata_accounts_v2(
ctx.accounts.token_metadata_program.key(),
ctx.accounts.metadata.key(),
ctx.accounts.mint.key(),
ctx.accounts.mint_authority.key(),
ctx.accounts.payer.key(),
ctx.accounts.payer.key(),
num_title,
symbol,
new_uri,
Some(creator),
1,
true,
false,
None,
None,
),
account_info.as_slice(),
)?;