Skip to content
This repository was archived by the owner on Oct 31, 2020. It is now read-only.

Random #10

Closed
bricelam opened this issue Apr 14, 2018 · 4 comments
Closed

Random #10

bricelam opened this issue Apr 14, 2018 · 4 comments

Comments

@bricelam
Copy link
Owner

Allow using the random() and randomblob() functions in LINQ. They don't quite align to .NET's Random class an probably need new functions on EF.Functions with client-side implementations.

Consider adding this to the actual provider.

@bricelam
Copy link
Owner Author

Evaluating these functions server-side seems to have no value that I can see. Closing as won't fix, but if you have a scenario for this, I'd love to hear it.

@bricelam bricelam added the wontfix This will not be worked on label May 15, 2018
@bricelam
Copy link
Owner Author

These can be useful for sampling data:

var sample = db.Data.OrderBy(_ => EF.Functions.Random()).Take(100);

@bricelam bricelam reopened this Apr 25, 2019
@bricelam bricelam removed the wontfix This will not be worked on label Apr 25, 2019
@bricelam
Copy link
Owner Author

With some bit twiddling, the random function can probaly used to translate members of the Random class.

@bricelam
Copy link
Owner Author

bricelam commented Jul 29, 2020

To get a more standard range...

SELECT abs(random() / 9223372036854775807.0);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant