← Developer Forum

Entropy·help question·✓ answered

User Random Number generation

Open on dev-forum →Back to forum

Hi
Can I generate my userRandomNumber on-chain that I need to pass to Entropy provider? Are there any security consideration regarding that?

  function requestRandomNumber(bytes32 userRandomNumber) external payable {
    // Get the default provider and the fee for the request
    address entropyProvider = entropy.getDefaultProvider();
    uint256 fee = entropy.getFee(entropyProvider);
 
    // Request the random number with the callback
    uint64 sequenceNumber = entropy.requestWithCallback{ value: fee }(
      entropyProvider,
      userRandomNumber
    );
    // Store the sequence number to identify the callback request
  }```

Showing the original post only. Read the full thread on dev-forum.pyth.network ↗

Replies: 1
Views: 482
Likes: 0
Posted: 4/2/2025

Source: https://dev-forum.pyth.network/t/user-random-number-generation/31 · external id 31