Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How do I get a random value in FunC?

Is there any way to get random value in Func? I'm looking for a VRF, though other solutions are appreciated too.


This question was imported from Telegram Chat: https://t.me/tondev_eng/9051

  
  
Posted one year ago
Votes Newest

Answers


Unfortunately I'm not familiar with any Oracle solutions that provide VRFs. Here is a way to get a random number, but it can still be manipulated by validators:

int seed = cell_hash(begin_cell()
    .store_uint(now(), 256)
    .store_uint(block_lt(), 256)
    .store_uint(cur_lt(), 256)
.end_cell());
randomize(seed);

Randomize can be put in more complex schemes to significantly decrease the probability that a validator will affect the random value, but there isn't anything flawless. Here's a link to more information:
https://ton.org/docs/develop/smart-contracts/guidelines/random-number-generation

1
1
Posted one year ago
Jeremy
404 × 5 Administrator
1K Views
1 Answer
one year ago
one year ago
Tags