Skip to content

[Feat] compile-time random #2078

Closed
Closed
@BWindey

Description

@BWindey

It would be cool to have compile-time variant of the current macros and functions providing random values at runtime. This should not be a complicated or particularly high entropy random generator, but could f.e. read out the needed bytes from /dev/random (on Unix) and insert them with the requested type in the code.

Example syntax:

int rand_nr = (int) $$RANDOM;

It could also be a function/macro (https://c3-lang.org/misc-advanced/builtins/), accepting ranges, types and/or length (amount bytes - usefull for array maybe?).

An alternative is using $exec() of course.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions