Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Regex can have discredited values #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guiled
Copy link
Member

@guiled guiled commented Feb 10, 2018

Like RealdomString does

This is a way to exclude some words from the Regex results.

I see "discredited values" in ReadldomString and I did it with a bounded (arbitrary to 5) loop.
Raises an exception if the number of tries exceeded the limit.

Like RealdomString does
@ghost ghost assigned guiled Feb 10, 2018
@ghost ghost added the in progress label Feb 10, 2018
@Hywan Hywan assigned Hywan and unassigned guiled Feb 12, 2018
@Hywan
Copy link
Member

Hywan commented Feb 12, 2018

Discreted values must be integer. It is used in the math pseudo-random generators to avoid re-generating already generated values. Once a value has been discredited, there is no way it can be generated again. This is a mathemetical property.

Here, the proposed algorithm is sampling and throwing already generated values. It's not really efficient.

I'm not sure it's the right way to approach the problem. What are you trying exactly?

@guiled
Copy link
Member Author

guiled commented Feb 12, 2018

I'm confused ! X-D I've exposed an XY Problem ;-)
Well I use Realdom to generate "identifier" but I was facing that sometimes the generated "identifier" is a "reserved keyword". So I try to prevent this (random) problem.
For your comprehension (and some funny memories), see here https://github.com/guiled/Hoathis-Lua/blob/v2/Tests/Unit/Visitor/Interpreter.php#L32-L64
I must confess that I tried to manage on my own and I am not sure I did it well (your answer is very clear and helpful !)

@guiled
Copy link
Member Author

guiled commented Feb 15, 2018

What do you think about a possible solution for my problem ?

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

Successfully merging this pull request may close these issues.

2 participants