# Updated project - questions

Just updating an older project.

j’ ’ strings - are these now no longer needed ?- emoji just seem to work in normal strings now.

Trying out core, is there a similar Array.range(1,12) function?
Doing something like

``````Array(12).fill().map((_, i) => i+1);
``````

Just gives me variant constructor errors.

Also an equivalent to Array.rangeBy(to, from, step)?

What would Js.Math.random_int(1, 12) be now, just removing the Js. prefix doesn’t work?

Looks like I can just remove Js.Global prefixes now too. Which is great.

Also do we still have to use useEffect0() etc… now ? (useEffect() seems to work).

string_to_int() would it be preferable to use Int.toString() now?

we use:

``````let range: int => array<int> = %raw(`(i) => [...Array(i).keys()]`)
``````

There’s `Int.range`.

`Int.rangeWithOptions`

2 Likes

Thanks. The function Belt.Array.ShuffleInPlace() is a really useful one too I couldn’t see that in the Int Module are there any plans to add it?

Why would it be in `Int`? It’s in `Array`.

Ah sorry I missed in was in Array. To be honest I wasn’t clear on the boundary but I suppose Int.range() takes ints and returns an array. (so a module can convert from it’s type to another type?)

The last one I can’t find is where Js.Math.random__int() is now?

`Int.range` returns an `array<int>`, `Float.range` returns an `array<float>`. I wouldn’t say it converts anything.

There isn’t one. That function doesn’t exist in JavaScript. So you have to do something similar to what you’d do in JavaScript, see Math.random() - JavaScript | MDN

``````let randomInt = (min, max) =>
Float.toInt(Math.random() *. float(max - min)) + min
``````
1 Like
{"ft_lang_label":"__label__en","ft_lang_prob":0.747278,"math_prob":0.6491265,"size":1568,"snap":"2023-14-2023-23","text_gpt3_token_len":414,"char_repetition_ratio":0.085038364,"word_repetition_ratio":0.0,"special_character_ratio":0.2780612,"punctuation_ratio":0.17329545,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9656961,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-06-05T20:46:51Z\",\"WARC-Record-ID\":\"<urn:uuid:44818296-5e3f-499e-b938-a34a153c2e27>\",\"Content-Length\":\"26329\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e0f0f13d-3a1b-4532-b64b-396ee0a1da28>\",\"WARC-Concurrent-To\":\"<urn:uuid:674f5189-2319-4370-990e-62f1f05af541>\",\"WARC-IP-Address\":\"64.227.27.123\",\"WARC-Target-URI\":\"https://forum.rescript-lang.org/t/updated-project-questions/4345\",\"WARC-Payload-Digest\":\"sha1:BLNVMLRFZTKOSGU3KNQOFJTJUKNJ2VMA\",\"WARC-Block-Digest\":\"sha1:FOXUFBO4WNNHYN2MJTPUNZ4J666HLM42\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-23/CC-MAIN-2023-23_segments_1685224652161.52_warc_CC-MAIN-20230605185809-20230605215809-00092.warc.gz\"}"}