Skip to content

Commit

Permalink
make get_random_cards function generic
Browse files Browse the repository at this point in the history
  • Loading branch information
manlikeHB committed Feb 18, 2025
1 parent aadca71 commit 4a7e350
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions onchain/src/contracts/lyricsflip.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ pub mod LyricsFlip {
assert(genre.is_some(), Errors::NON_EXISTING_GENRE);

let caller_address = get_caller_address();
let cards = self.get_random_cards(seed);
let amount: u64 = self.cards_per_round.read().into();
let cards = self.get_random_cards(amount, seed);

let round_id = self.round_count.read() + 1;
let round = Round {
Expand Down Expand Up @@ -341,8 +342,7 @@ pub mod LyricsFlip {

#[generate_trait]
pub impl InternalFunctions of InternalFunctionsTrait {
fn get_random_cards(self: @ContractState, seed: u64) -> Span<u64> {
let amount: u64 = self.cards_per_round.read().into();
fn get_random_cards(self: @ContractState, amount: u64, seed: u64) -> Span<u64> {
let limit = self.cards_count.read();
self._get_random_numbers(seed, amount, limit, false)
}
Expand Down

0 comments on commit 4a7e350

Please sign in to comment.